{"record":{"id":"481f896c0adea674","repo":"apache/cassandra","slug":"invalid-value-for-property-s-it-should-be-a-ma","errorCode":null,"errorMessage":"Invalid value for property '%s'. It should be a map.","messagePattern":"Invalid value for property '(.+?)'\\. It should be a map\\.","errorType":"validation","errorClass":"SyntaxException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/PropertyDefinitions.java","lineNumber":114,"sourceCode":"        if (val == null)\n            return null;\n        if (val instanceof Map && ((Map<?, ?>)val).isEmpty()) // to solve the ambiguity between empty map and empty set\n            return Collections.emptySet();\n        if (!(val instanceof Set))\n            throw new SyntaxException(String.format(\"Invalid value for property '%s'. It should be a set of identifiers.\", name));\n        return (Set<QualifiedName>) val;\n    }\n\n    @Nullable\n    protected Map<String, String> getMap(String name) throws SyntaxException\n    {\n        Object val = properties.get(name);\n        if (val == null)\n            return null;\n        if (val instanceof Set && ((Set<?>)val).isEmpty()) // to solve the ambiguity between empty map and empty set\n            return Collections.emptyMap();\n        if (!(val instanceof Map))\n            throw new SyntaxException(format(\"Invalid value for property '%s'. It should be a map.\", name));\n        return (Map<String, String>)val;\n    }\n\n    public boolean getBoolean(String key, boolean defaultValue) throws SyntaxException\n    {\n        String value = getString(key);\n        return value != null ? parseBoolean(key, value) : defaultValue;\n    }\n\n    public static boolean parseBoolean(String key, String value) throws SyntaxException\n    {\n        if (null == value)\n            throw new IllegalArgumentException(\"value argument can't be null\");\n\n        String lowerCasedValue = toLowerCaseLocalized(value);\n\n        if (POSITIVE_PATTERN.matcher(lowerCasedValue).matches())\n            return true;","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/PropertyDefinitions.java#L96-L132","documentation":"PropertyDefinitions.getMap() extracts a CQL property value (e.g. from CREATE/ALTER TABLE WITH options or credentials) that must be a map of string options. When the parsed property value exists but is neither a Map nor an empty Set (the sentinel for '{}'), the parser cannot interpret it as an option map and throws a SyntaxException. It signals that the syntax used for the property's value does not match the expected map literal form.","triggerScenarios":"Executing CQL like CREATE TABLE ... WITH options = 'string' or ALTER KEYSPACE WITH replication = 'SimpleStrategy' where the value after '=' parses to a scalar/list instead of a map literal, e.g. replication = SimpleStrategy or options = [1,2].","commonSituations":"Copy-pasted CQL missing the braces around map values (replication = SimpleStrategy instead of {'class': 'SimpleStrategy'}); quoting mistakes that make the parser treat the value as a string; hand-written migration scripts or tooling generating CQL programmatically.","solutions":["Wrap the property value in map-literal braces: WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': 3}","Quote each key and string value inside the map with single quotes","Check which property is named in the error and verify its expected shape in the CQL docs","If building CQL from code, ensure map-typed properties are rendered as {'k':'v', ...}"],"exampleFix":"// before\nCREATE KEYSPACE ks WITH replication = SimpleStrategy;\n// after\nCREATE KEYSPACE ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};","handlingStrategy":"validation","validationCode":"if (!/\\{\\s*'[^']+'\\s*:\\s*'[^']+'/.test(propValue) && !/^\\{\\s*\\}$/.test(propValue)) throw new Error(`Property ${name} must be a map literal: {'k':'v'}`);","typeGuard":"function isMapLiteral(v) { return typeof v === 'string' ? v.trim().startsWith('{') && v.trim().endsWith('}') : v instanceof Map; }","tryCatchPattern":null,"preventionTips":["Always render map-typed CQL properties as {'key':'value'} literals","Keep a helper that serializes option objects to CQL map syntax","Validate generated CQL with a parser (or run against a test keyspace) before deployment"],"tags":["cql","syntax","property-parsing"],"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-17T15:17:12.973Z"}