apache/druid · error · UOE

Unsupported field type[%s]

Error message

Unsupported field type[%s]

What it means

ObjectFlatteners.create() builds extractors for each fieldSpec in a flattenSpec; only ROOT, PATH, JQ, JSON_QUERY, and TREE field types are supported. A FieldSpec with any other type reaches the default branch and throws this UserResourceUnavailableException/UnsupportedOperationException (UOE).

Source

Thrown at processing/src/main/java/org/apache/druid/java/util/common/parsers/ObjectFlatteners.java:73

    final JSONPathSpec flattenSpec = flattenSpecInput == null ? JSONPathSpec.DEFAULT : flattenSpecInput;
    for (final JSONPathFieldSpec fieldSpec : flattenSpec.getFields()) {
      final Function<T, Object> extractor;

      switch (fieldSpec.getType()) {
        case ROOT:
          extractor = obj -> flattenerMaker.getRootField(obj, fieldSpec.getExpr());
          break;
        case PATH:
          extractor = flattenerMaker.makeJsonPathExtractor(fieldSpec.getExpr());
          break;
        case JQ:
          extractor = flattenerMaker.makeJsonQueryExtractor(fieldSpec.getExpr());
          break;
        case TREE:
          extractor = flattenerMaker.makeJsonTreeExtractor(fieldSpec.getNodes());
          break;
        default:
          throw new UOE("Unsupported field type[%s]", fieldSpec.getType());
      }

      if (extractors.put(fieldSpec.getName(), extractor) != null) {
        throw new IAE("Cannot have duplicate field definition: %s", fieldSpec.getName());
      }
    }

    return new ObjectFlattener<>()
    {
      @Override
      public Map<String, Object> flatten(final T obj)
      {
        return new AbstractMap<>()
        {
          @Override
          public int size()
          {
            return keySet().size();

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Fix the fieldSpec 'type' value to one of: root, path, jq, json_query, or tree
  2. Validate the flattenSpec JSON against the Druid schema for your Druid version before submitting the spec
  3. If using an extension-provided flattener, confirm the target parser actually supports the field type (e.g. makeJsonTreeExtractor is implemented)

Example fix

// before
{"type":"json", "name":"val", "expr":"$.a"}
// after
{"type":"jq", "name":"val", "expr":".a"}
Defensive patterns

Strategy: validation

Validate before calling

Set<String> allowed = Set.of("root","path","jq","json_query","tree");
for (FieldSpec fs : flattenSpec.getFlattener()) {
  if (!allowed.contains(fs.getType().toLowerCase())) throw new IllegalArgumentException("bad fieldSpec type: " + fs.getType());
}

Try / catch

try { flattener = ObjectFlatteners.create(spec, maker); } catch (UOE e) { throw new SpecValidationException("Unsupported flattenSpec field type", e); }

Prevention

When it happens

Trigger: Constructing an ObjectFlattener via ObjectFlatteners.create(flattenSpec, flattenerMaker) where a FieldSpec in the flattenSpec has a type outside the supported enum handling — typically from a hand-written or deserialized flattenSpec with an unknown 'type' string.

Common situations: Typo in a JSON ingestion spec fieldSpec type (e.g. "type":"json" instead of "jq"); older/newer Druid versions where a field type was added or removed; programmatically built FieldSpec objects with garbage values.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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