{"record":{"id":"8b1c91258745ebbf","repo":"apache/cassandra","slug":"invalid-value-for-property-s-it-should-not-be","errorCode":null,"errorMessage":"Invalid value for property '%s'. It should not be null.","messagePattern":"Invalid value for property '(.+?)'\\. It should not be null\\.","errorType":"validation","errorClass":"SyntaxException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/PropertyDefinitions.java","lineNumber":188,"sourceCode":"    {\n        if (null == value)\n            throw new IllegalArgumentException(\"value argument can't be null\");\n\n        try\n        {\n            return Double.parseDouble(value);\n        }\n        catch (NumberFormatException e)\n        {\n            throw new SyntaxException(format(\"Invalid double value %s for '%s'\", value, key));\n        }\n    }\n\n    public Object getProperty(String name)\n    {\n        Object ret = properties.get(name);\n        if (ret == null)\n            throw new SyntaxException(String.format(\"Invalid value for property '%s'. It should not be null.\", name));\n\n        return ret;\n    }\n}\n","sourceCodeStart":170,"sourceCodeEnd":193,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/PropertyDefinitions.java#L170-L193","documentation":"PropertyDefinitions.getProperty() returns the raw value of a previously added property but throws SyntaxException when the stored value is null. Since addProperty only stores non-null values in practice, hitting this means the property was never added or was explicitly mapped to null; callers use it to fetch required property values during statement preparation.","triggerScenarios":"Calling getProperty(name) (directly from Java, e.g. in custom table/compaction option handling or unit tests like testGetMissingProperty) for a property name that was never put into the PropertyDefinitions map.","commonSituations":"Custom CQL extension code or tests querying a misspelled property key; refactors that renamed a property constant; code paths assuming a property exists before checking hasProperty/containsKey.","solutions":["Check the property exists first (properties map / hasProperty) before calling getProperty","Fix the property name to match the key used in addProperty","Ensure addProperty is called with a non-null value for every required option","Provide a default via the typed getters (getString/getInt/getBoolean/getDouble) which take defaults"],"exampleFix":"// before\nObject compression = properties.getProperty(\"compressio\");\n// after\nif (properties.hasProperty(\"compression\")) {\n    Object compression = properties.getProperty(\"compression\");\n}","handlingStrategy":"validation","validationCode":"function requireProp(defs, name) { if (!defs.hasProperty || !defs.hasProperty(name)) throw new Error(`Missing required property: ${name}`); return defs.getProperty(name); }","typeGuard":"function hasNonNull(v) { return v !== null && v !== undefined; }","tryCatchPattern":"try { Object val = defs.getProperty(name); } catch (SyntaxException e) { if (e.getMessage().contains(\"should not be null\")) applyDefault(name); else throw e; }","preventionTips":["Call hasProperty/containsKey before getProperty for optional values","Prefer the typed getters (getString/getInt/...) which accept defaults","Centralize property-name constants to avoid key typos"],"tags":["cql","null","property-parsing"],"backgroundTag":"missing-required-argument","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"}