409 kafka data_error ai_generated true

io.confluent.kafka.schemaregistry.client.rest.exceptions.RestClientException:正在注册的模式与早期模式不兼容;错误代码:409

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

其他格式: JSON · Markdown 中文 · English
82%修复率
87%置信度
1证据数
2024-02-28首次发现

版本兼容性

版本状态引入弃用备注
confluent-schema-registry 7.4.0 active
confluent-schema-registry 7.5.0 active
confluent-schema-registry 7.6.0 active

根因分析

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

English

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

generic

官方文档

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

解决方案

  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.

无效尝试

常见但无效的做法:

  1. 70% 失败

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

  2. 85% 失败

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