{"record":{"id":"45a02f92778a3099","repo":"apache/druid","slug":"cannot-find-strategy-for-type-s","errorCode":null,"errorMessage":"Cannot find strategy for type [%s]","messagePattern":"Cannot find strategy for type \\[(.+?)\\]","errorType":"exception","errorClass":"IAE","httpStatus":null,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/math/expr/ExpressionTypeFactory.java","lineNumber":116,"sourceCode":"  {\n    final TypeStrategy strategy;\n    switch (expressionType.getType()) {\n      case LONG:\n        strategy = TypeStrategies.LONG;\n        break;\n      case DOUBLE:\n        strategy = TypeStrategies.DOUBLE;\n        break;\n      case STRING:\n        strategy = TypeStrategies.STRING;\n        break;\n      case ARRAY:\n        strategy = new TypeStrategies.ArrayTypeStrategy(expressionType);\n        break;\n      case COMPLEX:\n        TypeStrategy<?> complexStrategy = TypeStrategies.getComplex(expressionType.getComplexTypeName());\n        if (complexStrategy == null) {\n          throw new IAE(\"Cannot find strategy for type [%s]\", expressionType.asTypeString());\n        }\n        strategy = complexStrategy;\n        break;\n      default:\n        throw new ISE(\"Unsupported expression type[%s]\", expressionType.getType());\n    }\n    return strategy;\n  }\n}\n","sourceCodeStart":98,"sourceCodeEnd":126,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/math/expr/ExpressionTypeFactory.java#L98-L126","documentation":"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]'.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Load the extension that registers the complex type: add it to druid.extensions.loadList in the common runtime properties and restart.","Verify the complex type name matches what the extension registers (check TypeStrategies registration / extension docs).","Align extension versions across all nodes so the complex type name is consistent cluster-wide.","Catch IAE and return a clear 'unknown complex type / missing extension' error instead of a raw stack trace."],"exampleFix":"// before (runtime properties)\ndruid.extensions.loadList=[]\n// after\ndruid.extensions.loadList=[\"druid-datasketches\"] // load the extension owning the complex type","handlingStrategy":"validation","validationCode":"if (expressionType.is(ExprType.COMPLEX)\n    && TypeStrategies.getComplex(expressionType.getComplexTypeName()) == null) {\n  throw new IllegalStateException(\"Complex type not registered on this node: \"\n      + expressionType.getComplexTypeName() + \" - is the owning extension loaded?\");\n}","typeGuard":"boolean complexStrategyAvailable(ExpressionType t) {\n  return !t.is(ExprType.COMPLEX) || TypeStrategies.getComplex(t.getComplexTypeName()) != null;\n}","tryCatchPattern":"try {\n  TypeStrategy<?> s = ExpressionTypeFactory.getInstance().getTypeStrategy(exprType);\n} catch (IllegalArgumentException e) {\n  throw new MissingExtensionException(\"Extension for complex type not loaded: \" + e.getMessage());\n}","preventionTips":["Add the owning extension to druid.extensions.loadList on every node that reads the segments","Verify complex type names registered by the extension match the segments","Keep extension versions consistent across the cluster"],"tags":["druid","expressions","complex-types","extension-missing"],"backgroundTag":"missing-dependency","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}