{"record":{"id":"4b4374b8444c942a","repo":"apache/druid","slug":"first-argument-must-be-a-valid-complex-type-name","errorCode":null,"errorMessage":"first argument must be a valid COMPLEX type name, got unknown COMPLEX type [%s]","messagePattern":"first argument must be a valid COMPLEX type name, got unknown COMPLEX type \\[(.+?)\\]","errorType":"validation","errorClass":"ExpressionValidationException","httpStatus":400,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/math/expr/BuiltInExprMacros.java","lineNumber":88,"sourceCode":"          );\n        }\n        if (arg0.isNullLiteral()) {\n          throw validationFailed(\"first argument must be constant STRING expression containing a valid complex type name but got NULL instead\");\n        }\n        final Object literal = arg0.getLiteralValue();\n        if (!(literal instanceof String)) {\n          throw validationFailed(\n              \"first argument must be constant STRING expression containing a valid complex type name but got '%s' instead\",\n              arg0.getLiteralValue()\n          );\n        }\n\n        this.complexType = ExpressionTypeFactory.getInstance().ofComplex((String) literal);\n        try {\n          this.typeStrategy = complexType.getStrategy();\n        }\n        catch (IllegalArgumentException illegal) {\n          throw validationFailed(\n              \"first argument must be a valid COMPLEX type name, got unknown COMPLEX type [%s]\",\n              complexType.asTypeString()\n          );\n        }\n      }\n\n      @Override\n      public ExprEval<?> eval(ObjectBinding bindings)\n      {\n        ExprEval<?> toDecode = args.get(1).eval(bindings);\n        if (toDecode.value() == null) {\n          return ExprEval.ofComplex(complexType, null);\n        }\n        final Object serializedValue = toDecode.value();\n        final byte[] base64;\n        if (serializedValue instanceof String) {\n          base64 = StringUtils.decodeBase64String(toDecode.asString());\n        } else if (serializedValue instanceof byte[]) {","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/math/expr/BuiltInExprMacros.java#L70-L106","documentation":"After the first argument of complex_decode_base64 is confirmed to be a constant string, it is resolved via ExpressionTypeFactory.ofComplex and its type strategy is fetched. If the named complex type is unknown (no registered strategy), this validationFailed is thrown listing the invalid COMPLEX type name.","triggerScenarios":"Calling complex_decode_base64('someUnknownType', col) where the string is not a registered complex type name in the cluster (e.g. missing an extension that provides the complex type serializer).","commonSituations":"Extension not loaded on the cluster (e.g. druid-datasketches types used without the extension); typo in the type name; type exists on one broker/service but not another after a version change.","solutions":["Verify the exact registered complex type name (e.g. via available types/segment metadata).","Load the Druid extension that registers the complex type (e.g. druid-datasketches) on all relevant services.","Fix typos in the type name string.","Check druid.extension.load list in runtime.properties."],"exampleFix":"// before\ncomplex_decode_base64('mySketchTypo', base64_col)\n// after\ncomplex_decode_base64('hyperUnique', base64_col)  // or load the extension providing the correct type","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":["druid","expressions","complex-types","extensions"],"backgroundTag":"invalid-enum-value","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"}