apache/druid · error · InvalidProtocolBufferException

Invalid map field.

Error message

Invalid map field.

What it means

Structure validation in ProtobufConverter.convertMap: the field expected to be a protobuf map entry lacks the required key/value message-type structure (message type or key/value field descriptors missing), so the converter cannot iterate it as a map.

Solutions

  1. Verify the .proto schema actually declares the field as a map<K,V> entry.
  2. Regenerate the descriptor from the correct schema version.
  3. Check that the message instance matches the descriptor used to parse it.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at extensions-core/protobuf-extensions/src/main/java/org/apache/druid/data/input/protobuf/ProtobufConverter.java:118 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/a7d829cd48bb8d6f. Report an issue: GitHub.

Appendix: source

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

  private static List<Object> convertList(Descriptors.FieldDescriptor field, List<?> value)
      throws InvalidProtocolBufferException
  {
    final List<Object> theList = Lists.newArrayListWithExpectedSize(value.size());
    for (Object element : value) {
      theList.add(convertSingleValue(field, element));
    }
    return theList;
  }

  @Nullable
  private static Object convertMap(Descriptors.FieldDescriptor field, Object value)
      throws InvalidProtocolBufferException
  {
    final Descriptors.Descriptor type = field.getMessageType();
    final Descriptors.FieldDescriptor keyField = type.findFieldByName("key");
    final Descriptors.FieldDescriptor valueField = type.findFieldByName("value");
    if (keyField == null || valueField == null) {
      throw new InvalidProtocolBufferException("Invalid map field.");
    }

    @SuppressWarnings("unchecked")
    final List<Object> elements = (List<Object>) value;
    final HashMap<String, Object> theMap = Maps.newHashMapWithExpectedSize(elements.size());
    for (Object element : elements) {
      Message entry = (Message) element;
      theMap.put(
          (String) convertSingleValue(keyField, entry.getField(keyField)),
          convertSingleValue(valueField, entry.getField(valueField))
      );
    }
    return theMap;
  }

  @Nullable
  private static Object convertSingleValue(Descriptors.FieldDescriptor field, Object value)
      throws InvalidProtocolBufferException

View on GitHub (pinned to 9b90983fd2)