apache/druid · error · IAE

Cannot find strategy for type [%s]

Error message

Cannot find strategy for type [%s]

What it means

ExpressionTypeFactory.getTypeStrategy() looks up the binary/serialization TypeStrategy for an ExpressionType. For COMPLEX types it delegates to TypeStrategies.getComplex(complexTypeName); if no strategy is registered for that complex type name (typically because the extension that owns the complex type is not loaded), it throws IAE 'Cannot find strategy for type [x]'.

Source

Thrown at processing/src/main/java/org/apache/druid/math/expr/ExpressionTypeFactory.java:116

  {
    final TypeStrategy strategy;
    switch (expressionType.getType()) {
      case LONG:
        strategy = TypeStrategies.LONG;
        break;
      case DOUBLE:
        strategy = TypeStrategies.DOUBLE;
        break;
      case STRING:
        strategy = TypeStrategies.STRING;
        break;
      case ARRAY:
        strategy = new TypeStrategies.ArrayTypeStrategy(expressionType);
        break;
      case COMPLEX:
        TypeStrategy<?> complexStrategy = TypeStrategies.getComplex(expressionType.getComplexTypeName());
        if (complexStrategy == null) {
          throw new IAE("Cannot find strategy for type [%s]", expressionType.asTypeString());
        }
        strategy = complexStrategy;
        break;
      default:
        throw new ISE("Unsupported expression type[%s]", expressionType.getType());
    }
    return strategy;
  }
}

View on GitHub (pinned to 9b90983fd2)

Solutions

  1. Load the extension that registers the complex type: add it to druid.extensions.loadList in the common runtime properties and restart.
  2. Verify the complex type name matches what the extension registers (check TypeStrategies registration / extension docs).
  3. Align extension versions across all nodes so the complex type name is consistent cluster-wide.
  4. Catch IAE and return a clear 'unknown complex type / missing extension' error instead of a raw stack trace.

Example fix

// before (runtime properties)
druid.extensions.loadList=[]
// after
druid.extensions.loadList=["druid-datasketches"] // load the extension owning the complex type
Defensive patterns

Strategy: validation

Validate before calling

if (expressionType.is(ExprType.COMPLEX)
    && TypeStrategies.getComplex(expressionType.getComplexTypeName()) == null) {
  throw new IllegalStateException("Complex type not registered on this node: "
      + expressionType.getComplexTypeName() + " - is the owning extension loaded?");
}

Type guard

boolean complexStrategyAvailable(ExpressionType t) {
  return !t.is(ExprType.COMPLEX) || TypeStrategies.getComplex(t.getComplexTypeName()) != null;
}

Try / catch

try {
  TypeStrategy<?> s = ExpressionTypeFactory.getInstance().getTypeStrategy(exprType);
} catch (IllegalArgumentException e) {
  throw new MissingExtensionException("Extension for complex type not loaded: " + e.getMessage());
}

Prevention

When it happens

Trigger: Requesting a TypeStrategy for an ExpressionType whose complex type name is unknown to the running Druid process — e.g. ExpressionTypeFactory.getInstance().getTypeStrategy(complexExprType) where TypeStrategies.getComplex(name) returns null because the owning extension isn't loaded on this node.

Common situations: Querying segments written with an extension's complex columns (e.g. sketches, HLL, custom serializers) on a broker/historical node where that extension is not in druid.extensions.loadList; extension version mismatch changing the registered complex type name.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


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