{"record":{"id":"6e5f06440743cff8","repo":"apache/druid","slug":"descriptor-needs-to-be-initialized-before-parsing","errorCode":null,"errorMessage":"Descriptor needs to be initialized before parsing","messagePattern":"Descriptor needs to be initialized before parsing","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions-core/protobuf-extensions/src/main/java/org/apache/druid/data/input/protobuf/DescriptorBasedProtobufBytesDecoder.java","lineNumber":93,"sourceCode":"  }\n\n  @VisibleForTesting\n  void initializeDescriptor()\n  {\n    if (this.descriptor == null) {\n      final var descriptorSet = loadFileDescriptorSet();\n      this.descriptor = buildMessageDescriptor(descriptorSet);\n    }\n  }\n\n  /**\n   * Uses the generated descriptor to parse a message from the byte stream.\n   */\n  @Override\n  public DynamicMessage parse(ByteBuffer bytes)\n  {\n    if (descriptor == null) {\n      throw new IAE(\"Descriptor needs to be initialized before parsing\");\n    }\n\n    try {\n      return DynamicMessage.parseFrom(descriptor, ByteString.copyFrom(bytes));\n    }\n    catch (Exception e) {\n      throw new ParseException(\n          null,\n          e,\n          \"Failed to decode protobuf message with the provided descriptor [%s]\",\n          descriptor.getFullName()\n      );\n    }\n  }\n\n  /**\n   * Load the FileDescriptorSet containing protobuf schema definitions from the concrete implementation's source.\n   */","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-core/protobuf-extensions/src/main/java/org/apache/druid/data/input/protobuf/DescriptorBasedProtobufBytesDecoder.java#L75-L111","documentation":"Lifecycle guard in DescriptorBasedProtobufBytesDecoder.parse: parse() was invoked before initializeDescriptor() ran, leaving the message descriptor null, so protobuf bytes cannot be decoded. This indicates the decoder was used out of order or initialization silently failed upstream.","triggerScenarios":"Thrown at extensions-core/protobuf-extensions/src/main/java/org/apache/druid/data/input/protobuf/DescriptorBasedProtobufBytesDecoder.java:93 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the decoder's init/initializeDescriptor() is called before parse() (normally done by the parser factory).","Check logs for earlier failures loading the descriptor file that left descriptor null.","Validate the protobufBytesDecoder spec so descriptor loading succeeds at startup."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}