{"record":{"id":"ca8eea9c3566c48f","repo":"apache/cassandra","slug":"cannot-parse-map-value-from-s-at-character-d-ca8eea","errorCode":null,"errorMessage":"Cannot parse map value from \"%s\", at character %d expecting ':' but got '%c'","messagePattern":"Cannot parse map value from \"(.+?)\", at character (.+?) expecting ':' but got '%c'","errorType":"exception","errorClass":"InvalidTypeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/functions/types/TypeCodec.java","lineNumber":2389,"sourceCode":"                try\n                {\n                    n = ParseUtils.skipCQLValue(value, idx);\n                }\n                catch (IllegalArgumentException e)\n                {\n                    throw new InvalidTypeException(\n                    String.format(\n                    \"Cannot parse map value from \\\"%s\\\", invalid CQL value at character %d\",\n                    value, idx),\n                    e);\n                }\n\n                K k = keyCodec.parse(value.substring(idx, n));\n                idx = n;\n\n                idx = ParseUtils.skipSpaces(value, idx);\n                if (value.charAt(idx++) != ':')\n                    throw new InvalidTypeException(\n                    String.format(\n                    \"Cannot parse map value from \\\"%s\\\", at character %d expecting ':' but got '%c'\",\n                    value, idx, value.charAt(idx)));\n                idx = ParseUtils.skipSpaces(value, idx);\n\n                try\n                {\n                    n = ParseUtils.skipCQLValue(value, idx);\n                }\n                catch (IllegalArgumentException e)\n                {\n                    throw new InvalidTypeException(\n                    String.format(\n                    \"Cannot parse map value from \\\"%s\\\", invalid CQL value at character %d\",\n                    value, idx),\n                    e);\n                }\n","sourceCodeStart":2371,"sourceCodeEnd":2407,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/functions/types/TypeCodec.java#L2371-L2407","documentation":"Thrown while parsing a map literal when the character after a key is not the key/value separator ':'. Each entry in a CQL map literal must be 'key:value'; the parser reports the actual character found at the failing position.","triggerScenarios":"Calling MapCodec.parse() with entries using the wrong separator, e.g. \"{1='a'}\" (uses '='), \"{1 'a'}\" (missing separator), or \"{1->'a'}\".","commonSituations":"Confusing protocol syntaxes (JSON/Python dict with ':' vs CQL requires ':' but with quoted keys); pasted literals where ':' was lost in copy/paste; generating literals from a template with wrong separator.","solutions":["Use ':' between key and value in every map entry","Verify the literal follows CQL map syntax: {k1:v1,k2:v2}","Regenerate the literal with codec.format() rather than hand formatting"],"exampleFix":"// before\nmapCodec.parse(\"{1='a'}\");\n// after\nmapCodec.parse(\"{1:'a'}\");","handlingStrategy":"validation","validationCode":"if (value.contains(\"='\" ) || value.matches(\".*\\\\d\\\\s+'\"))\n    throw new IllegalArgumentException(\"Use ':' between map key and value: \" + value);\nmapCodec.parse(value);","typeGuard":null,"tryCatchPattern":"try {\n    mapCodec.parse(value);\n} catch (InvalidTypeException e) {\n    throw new IllegalArgumentException(\"Map entries must be key:value pairs — \" + e.getMessage(), e);\n}","preventionTips":["Use ':' (not '=') between key and value in CQL map literals","Validate literal shape with a regex like \\\\{.*:.*\\\\} before parsing","Generate literals via codec.format()"],"tags":["cql","parsing","map","codec"],"backgroundTag":"invalid-argument-format","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}