{"record":{"id":"2ab8523841e215b0","repo":"apache/druid","slug":"no-avro-schema-id-s-in-registry","errorCode":null,"errorMessage":"No Avro schema id[%s] in registry","messagePattern":"No Avro schema id\\[(.+?)\\] in registry","errorType":"exception","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/SchemaRegistryBasedAvroBytesDecoder.java","lineNumber":172,"sourceCode":"        throw new ParseException(\n            null,\n            ex2,\n            \"Failed to authenticate to schema registry for Avro schema id[%s]. Please check your credentials.\",\n            id\n        );\n      }\n      // For all other errors, just include the code and message received from the library.\n      throw new ParseException(\n          null,\n          ex2,\n          \"Failed to fetch Avro schema id[%s] from registry. Error code[%s] and message[%s].\",\n          id,\n          ex2.getErrorCode(),\n          ex2.getMessage()\n      );\n    }\n    if (schema == null) {\n      throw new ParseException(null, \"No Avro schema id[%s] in registry\", id);\n    }\n    DatumReader<GenericRecord> reader = new GenericDatumReader<>(schema);\n    try {\n      return reader.read(null, DecoderFactory.get().binaryDecoder(bytes.array(), offset, length, null));\n    }\n    catch (Exception e) {\n      throw new ParseException(null, e, \"Failed to decode Avro message for schema id[%s]\", id);\n    }\n  }\n\n  @Override\n  public boolean equals(Object o)\n  {\n    if (this == o) {\n      return true;\n    }\n    if (o == null || getClass() != o.getClass()) {\n      return false;","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/SchemaRegistryBasedAvroBytesDecoder.java#L154-L190","documentation":"Thrown when the schema lookup path did not fail with an exception but returned a null (non-Avro) schema — e.g., registry.getSchemaById returned a ParsedSchema that is not an AvroSchema — so no Avro schema is available for the given id.","triggerScenarios":"parse(ByteBuffer bytes) receives a wire-format id whose entry in the registry is a non-Avro schema type (JSON, Protobuf) or an unexpected null result, so `schema == null` after the fetch attempt.","commonSituations":"Topic shared across producers using different serialization formats (Protobuf/JSON schemas registered under ids seen by this Avro decoder); misregistered schema types; custom registry wrappers returning null.","solutions":["Confirm the schema id in the message maps to an Avro schema: curl http://<registry>/schemas/ids/<id> and check schemaType","Separate topics/formats so Avro decoder only consumes Avro-serialized messages","Check for registry wrapper/compatibility layers returning non-Avro ParsedSchema","Fix the producer to register Avro schemas for this topic"],"exampleFix":"// before: producer registers JSON schema for shared topic\n// after: use dedicated Avro topic or AvroSchemaUtils.register() on producer\nSchema schema = ...;\nint id = AvroSchemaUtils.register(schema, schemaRegistryClient);","handlingStrategy":"validation","validationCode":"// confirm the id maps to an Avro schema\nString body = httpGet(\"http://registry:8081/schemas/ids/\" + id);\nif (!body.contains(\"\\\"schemaType\\\":\\\"AVRO\\\"\") && body.contains(\"protobuf|JSON\")) {\n  throw new IllegalStateException(\"Schema id \" + id + \" is not Avro\");\n}","typeGuard":"null","tryCatchPattern":"try {\n  GenericRecord record = decoder.parse(bytes);\n} catch (ParseException e) {\n  if (e.getMessage().startsWith(\"No Avro schema id\")) {\n    LOG.error(e, \"Non-Avro schema under id; check topic/producer format\");\n  }\n}","preventionTips":["Do not share topics across Avro/Protobuf/JSON producers","Enforce per-topic serialization standards","Audit registry subject types periodically","Name subjects with format suffixes to avoid confusion"],"tags":["avro","schema-registry","type-mismatch"],"backgroundTag":"unexpected-response-shape","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}