# Avro schema evolution fails when field type changes from int to long

- **ID:** `data/avro-schema-evolution-field-type-change`
- **Domain:** data
- **Category:** schema_error
- **Error Code:** `AVRO_SCHEMA_EVOLUTION_TYPE_MISMATCH`
- **Verification:** ai_generated
- **Fix Rate:** 75%

## Root Cause

Avro schema evolution does not allow changing a field's type from int to long without a custom conversion, as it violates backward compatibility rules.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Apache Avro 1.11.0 | active | — | — |
| Confluent Schema Registry 7.5.0 | active | — | — |

## Workarounds

1. **Define a new field with the target type (e.g., 'new_field' as long) and deprecate the old field. Update producers to write to the new field and consumers to read from both.** (85% success)
   ```
   Define a new field with the target type (e.g., 'new_field' as long) and deprecate the old field. Update producers to write to the new field and consumers to read from both.
   ```
2. **Use a custom logical type conversion in the schema registry to handle int-to-long promotion, e.g., by setting `avro.schema.conversion` property.** (70% success)
   ```
   Use a custom logical type conversion in the schema registry to handle int-to-long promotion, e.g., by setting `avro.schema.conversion` property.
   ```

## Dead Ends

- **** — Simply adding a default value to the field does not resolve the type change issue because Avro checks the type compatibility first. (80% fail)
- **** — Deleting and recreating the schema entirely breaks existing data streams and requires reprocessing all historical data. (90% fail)
