apache/druid · error · ParseException

No Avro schema id[%s] in registry

Error message

No Avro schema id[%s] in registry

What it means

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.

Source

Thrown at extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/SchemaRegistryBasedAvroBytesDecoder.java:172

        throw new ParseException(
            null,
            ex2,
            "Failed to authenticate to schema registry for Avro schema id[%s]. Please check your credentials.",
            id
        );
      }
      // For all other errors, just include the code and message received from the library.
      throw new ParseException(
          null,
          ex2,
          "Failed to fetch Avro schema id[%s] from registry. Error code[%s] and message[%s].",
          id,
          ex2.getErrorCode(),
          ex2.getMessage()
      );
    }
    if (schema == null) {
      throw new ParseException(null, "No Avro schema id[%s] in registry", id);
    }
    DatumReader<GenericRecord> reader = new GenericDatumReader<>(schema);
    try {
      return reader.read(null, DecoderFactory.get().binaryDecoder(bytes.array(), offset, length, null));
    }
    catch (Exception e) {
      throw new ParseException(null, e, "Failed to decode Avro message for schema id[%s]", id);
    }
  }

  @Override
  public boolean equals(Object o)
  {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Confirm the schema id in the message maps to an Avro schema: curl http://<registry>/schemas/ids/<id> and check schemaType
  2. Separate topics/formats so Avro decoder only consumes Avro-serialized messages
  3. Check for registry wrapper/compatibility layers returning non-Avro ParsedSchema
  4. Fix the producer to register Avro schemas for this topic

Example fix

// before: producer registers JSON schema for shared topic
// after: use dedicated Avro topic or AvroSchemaUtils.register() on producer
Schema schema = ...;
int id = AvroSchemaUtils.register(schema, schemaRegistryClient);
Defensive patterns

Strategy: validation

Validate before calling

// confirm the id maps to an Avro schema
String body = httpGet("http://registry:8081/schemas/ids/" + id);
if (!body.contains("\"schemaType\":\"AVRO\"") && body.contains("protobuf|JSON")) {
  throw new IllegalStateException("Schema id " + id + " is not Avro");
}

Type guard

null

Try / catch

try {
  GenericRecord record = decoder.parse(bytes);
} catch (ParseException e) {
  if (e.getMessage().startsWith("No Avro schema id")) {
    LOG.error(e, "Non-Avro schema under id; check topic/producer format");
  }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of apache/druid@9b90983fd2 (2026-09-07). Data as JSON: /api/errors/2ab8523841e215b0. Report an issue: GitHub.