409 kafka data_error ai_generated true

io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException: Schema being registered is incompatible with an earlier schema; error code: 409

ID: kafka/schema-registry-incompatible-schema

Also available as: JSON · Markdown · 中文
82%Fix Rate
87%Confidence
1Evidence
2024-02-28First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
confluent-schema-registry 7.4.0 active
confluent-schema-registry 7.5.0 active
confluent-schema-registry 7.6.0 active

Root Cause

The Avro or Protobuf schema being registered violates the compatibility rules (e.g., BACKWARD, FORWARD) configured in Schema Registry.

generic

中文

正在注册的Avro或Protobuf模式违反了Schema Registry中配置的兼容性规则(例如BACKWARD、FORWARD)。

Official Documentation

https://docs.confluent.io/platform/current/schema-registry/avro.html

Workarounds

  1. 90% success Modify the new schema to be backward-compatible by adding fields with defaults, or by using the Schema Registry's compatibility checker via REST API to identify the incompatibility.
    Modify the new schema to be backward-compatible by adding fields with defaults, or by using the Schema Registry's compatibility checker via REST API to identify the incompatibility.
  2. 85% success Temporarily set the subject's compatibility to BACKWARD_TRANSITIVE to allow evolution with defaults, then change back after registration.
    Temporarily set the subject's compatibility to BACKWARD_TRANSITIVE to allow evolution with defaults, then change back after registration.

中文步骤

  1. Modify the new schema to be backward-compatible by adding fields with defaults, or by using the Schema Registry's compatibility checker via REST API to identify the incompatibility.
  2. Temporarily set the subject's compatibility to BACKWARD_TRANSITIVE to allow evolution with defaults, then change back after registration.

Dead Ends

Common approaches that don't work:

  1. 70% fail

    Deleting schemas may break existing consumers that rely on the old schema, and Schema Registry may prevent deletion if subjects are referenced.

  2. 85% fail

    This disables schema evolution validation, which can lead to deserialization errors in production when consumers encounter unexpected fields.