{"record":{"id":"969653d491603add","repo":"apache/cassandra","slug":"s-is-not-a-collection-type","errorCode":null,"errorMessage":"%s is not a collection type","messagePattern":"(.+?) is not a collection type","errorType":"validation","errorClass":"SyntaxException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/marshal/TypeParser.java","lineNumber":381,"sourceCode":"            if (str.charAt(idx) == ')')\n            {\n                ++idx;\n                return map;\n            }\n\n            ByteBuffer bb = fromHex(readNextIdentifier());\n\n            skipBlank();\n            if (str.charAt(idx) != ':')\n                throwSyntaxError(\"expecting ':' token\");\n\n            ++idx;\n            skipBlank();\n            try\n            {\n                AbstractType<?> type = parse();\n                if (!(type instanceof CollectionType))\n                    throw new SyntaxException(type + \" is not a collection type\");\n                map.put(bb, (CollectionType)type);\n            }\n            catch (SyntaxException e)\n            {\n                SyntaxException ex = new SyntaxException(String.format(\"Exception while parsing '%s' around char %d\", str, idx));\n                ex.initCause(e);\n                throw ex;\n            }\n        }\n        throw new SyntaxException(String.format(\"Syntax error parsing '%s' at char %d: unexpected end of string\", str, idx));\n    }\n\n    private ByteBuffer fromHex(String hex) throws SyntaxException\n    {\n        try\n        {\n            return ByteBufferUtil.hexToBytes(hex);\n        }","sourceCodeStart":363,"sourceCodeEnd":399,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/marshal/TypeParser.java#L363-L399","documentation":"Inside TypeParser.getCollectionsParameters() (used to parse DynamicCompositeType-style hex-keyed collection arguments), each parsed type must be a CollectionType (map, set, or list). This SyntaxException is thrown when a value type resolves to a non-collection AbstractType, e.g. a plain comparator like UTF8Type or Int32Type.","triggerScenarios":"Parsing a collections parameter string where a value after '<hexkey>:' parses to a non-collection type, e.g. a parameter string like \"(6b6579:UTF8Type)\" passed through getCollectionsParameters() — only map/set/list types are accepted after the colon.","commonSituations":"Developers defining DynamicCompositeType parameters who supply a scalar comparator where only ListType/SetType/MapType is allowed, copy-pasting comparator names between type families, or constructing the parameter map programmatically with the wrong AbstractType subclass.","solutions":["Use a collection type after the colon, e.g. MapType.getInstance(TypeParser) form: replace UTF8Type with ListType(UTF8Type), SetType(Int32Type) or MapType(UTF8Type, Int32Type)","Check the message's leading type name to see which non-collection type was rejected and why it appeared","Verify the intent: if the field is not meant to hold collections, don't use getCollectionsParameters/DynamicCompositeType at all — use CompositeType","Consult the schema docs for DynamicCompositeType: every aliased value must be a collection type"],"exampleFix":"// before\nTypeParser.parse(\"DynamicCompositeType(a => Int32Type)\");\n// after\nTypeParser.parse(\"DynamicCompositeType(a => ListType(Int32Type))\");","handlingStrategy":"type-guard","validationCode":"static boolean valuesAreCollectionTypes(Collection<AbstractType<?>> types) {\n    return types.stream().allMatch(t -> t instanceof CollectionType);\n}","typeGuard":"static boolean isCollectionType(AbstractType<?> t) {\n    return t instanceof CollectionType; // MapType, SetType, ListType\n}","tryCatchPattern":"try {\n    AbstractType<?> t = TypeParser.parse(dynamicCompositeString);\n} catch (SyntaxException e) {\n    if (e.getMessage().contains(\"is not a collection type\"))\n        throw new SchemaConfigurationException(\"DynamicCompositeType values must be map/set/list types\", e);\n    throw e;\n}","preventionTips":["In DynamicCompositeType alias maps, only use ListType/SetType/MapType as values","Read the rejected type name from the message to identify the offending entry","If you need scalars, use CompositeType rather than DynamicCompositeType"],"tags":["cassandra","type-parser","collection-type","invalid-argument-value"],"backgroundTag":"invalid-argument-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}