{"record":{"id":"c9c5f62e6c32a335","repo":"apache/druid","slug":"failed-to-fetch-avro-schema-id-s-from-registry-c9c5f6","errorCode":null,"errorMessage":"Failed to fetch Avro schema id[%s] from registry. Error code[%s] and message[%s].","messagePattern":"Failed to fetch Avro schema id\\[(.+?)\\] from registry\\. Error code\\[(.+?)\\] and message\\[(.+?)\\]\\.","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":162,"sourceCode":"          null,\n          ex1,\n          \"Failed to fetch Avro schema id[%s] from registry. Check if the schema exists in the registry. Otherwise it\"\n          + \" could mean that there is malformed data in the stream or data that doesn't conform to the schema\"\n          + \" specified.\",\n          id\n      );\n    }\n    catch (RestClientException ex2) {\n      if (ex2.getErrorCode() == 401) {\n        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    }","sourceCodeStart":144,"sourceCodeEnd":180,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/avro-extensions/src/main/java/org/apache/druid/data/input/avro/SchemaRegistryBasedAvroBytesDecoder.java#L144-L180","documentation":"Catch-all thrown when RestClientException with an error code other than 401 occurs while fetching an Avro schema from the Confluent schema registry. The registry returned an HTTP error; the code and message from the client library are embedded in the ParseException.","triggerScenarios":"parse(ByteBuffer bytes) calls registry.getSchemaById(id) and the registry responds with an HTTP error other than 401: 404 (unknown id), 403 (forbidden), 429 (rate limited), 5xx (registry outage), or connectivity errors surfaced as RestClientException.","commonSituations":"Schema deleted from registry (404); Confluent Cloud plan limits hit (429); registry under load or restarting (5xx); misconfigured registry URL hitting the wrong endpoint (HTML 404 pages).","solutions":["Read the embedded error code: 404 means the id is missing from the registry — verify or re-register it; 429 means back off/reduce polling; 5xx means retry after registry recovers","Verify the schema registry URL and reachability from Druid","Check registry server logs for the correlated error","Add retries/alerting for transient registry unavailability"],"exampleFix":"null","handlingStrategy":"retry","validationCode":"// preflight registry status\ncurl -f http://schema-registry:8081/status > /dev/null && echo OK || echo REGISTRY_DOWN","typeGuard":null,"tryCatchPattern":"Retryer<GenericRecord> retryer = RetryerBuilder.<GenericRecord>newBuilder()\n    .retryIfException(e -> e instanceof ParseException\n        && e.getMessage().contains(\"Error code\"))\n    .withWaitStrategy(WaitStrategies.exponentialWait(500, 30, TimeUnit.SECONDS))\n    .withStopStrategy(StopStrategies.stopAfterDelay(2, TimeUnit.MINUTES))\n    .build();","preventionTips":["Monitor registry 429/5xx rates and set alerts","Configure registry subject compatibility rules to prevent accidental deletes","Provide capacity headroom on the registry for ingestion bursts","Log and surface the embedded error code for triage"],"tags":["avro","schema-registry","http-error"],"backgroundTag":"upstream-api-error","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"}