apache/druid · error · IllegalArgumentException

Descriptor needs to be initialized before parsing

Error message

Descriptor needs to be initialized before parsing

What it means

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.

Solutions

  1. Ensure the decoder's init/initializeDescriptor() is called before parse() (normally done by the parser factory).
  2. Check logs for earlier failures loading the descriptor file that left descriptor null.
  3. Validate the protobufBytesDecoder spec so descriptor loading succeeds at startup.
Defensive patterns

Strategy: validation

When it happens

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

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at extensions-core/protobuf-extensions/src/main/java/org/apache/druid/data/input/protobuf/DescriptorBasedProtobufBytesDecoder.java:93

  }

  @VisibleForTesting
  void initializeDescriptor()
  {
    if (this.descriptor == null) {
      final var descriptorSet = loadFileDescriptorSet();
      this.descriptor = buildMessageDescriptor(descriptorSet);
    }
  }

  /**
   * Uses the generated descriptor to parse a message from the byte stream.
   */
  @Override
  public DynamicMessage parse(ByteBuffer bytes)
  {
    if (descriptor == null) {
      throw new IAE("Descriptor needs to be initialized before parsing");
    }

    try {
      return DynamicMessage.parseFrom(descriptor, ByteString.copyFrom(bytes));
    }
    catch (Exception e) {
      throw new ParseException(
          null,
          e,
          "Failed to decode protobuf message with the provided descriptor [%s]",
          descriptor.getFullName()
      );
    }
  }

  /**
   * Load the FileDescriptorSet containing protobuf schema definitions from the concrete implementation's source.
   */

View on GitHub (pinned to 9b90983fd2)