{"record":{"id":"e63b0fddb2b2d6db","repo":"apache/cassandra","slug":"multiple-definitions-for-property-s","errorCode":null,"errorMessage":"Multiple definitions for property '%s'","messagePattern":"Multiple definitions for property '(.+?)'","errorType":"validation","errorClass":"SyntaxException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/PropertyDefinitions.java","lineNumber":50,"sourceCode":"import org.apache.cassandra.exceptions.SyntaxException;\n\nimport static java.lang.String.format;\nimport static org.apache.cassandra.utils.LocalizeString.toLowerCaseLocalized;\n\npublic class PropertyDefinitions\n{\n    public static final String MULTIPLE_DEFINITIONS_ERROR = \"Multiple definitions for property '%s'\";\n\n    private static final Pattern POSITIVE_PATTERN = Pattern.compile(\"(1|true|yes)\");\n    private static final Pattern NEGATIVE_PATTERN = Pattern.compile(\"(0|false|no)\");\n    private static final Logger logger = LoggerFactory.getLogger(PropertyDefinitions.class);\n\n    protected final Map<String, Object> properties = new HashMap<>();\n\n    public void addProperty(String name, Object value) throws SyntaxException\n    {\n        if (properties.putIfAbsent(name, value) != null)\n            throw new SyntaxException(format(MULTIPLE_DEFINITIONS_ERROR, name));\n    }\n\n    public void validate(Set<String> keywords, Set<String> obsolete) throws SyntaxException\n    {\n        for (String name : properties.keySet())\n        {\n            if (keywords.contains(name))\n                continue;\n\n            if (obsolete.contains(name))\n                logger.warn(\"Ignoring obsolete property {}\", name);\n            else\n                throw new SyntaxException(format(\"Unknown property '%s'\", name));\n        }\n    }\n\n    public Set<String> updatedProperties()\n    {","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/PropertyDefinitions.java#L32-L68","documentation":"PropertyDefinitions.addProperty() stores CREATE/ALTER statement properties (e.g. WITH options) in a map using putIfAbsent. If the same property is specified more than once in the statement, the second value is rejected with a SyntaxException formatted from MULTIPLE_DEFINITIONS_ERROR.","triggerScenarios":"CREATE KEYSPACE/TABLE/ROLE ... WITH option1 = x AND option1 = y; — duplicate property in the WITH clause.","commonSituations":"Programmatic query builders appending the same option twice; copy-paste in schema scripts; merging generated options fragments.","solutions":["Remove the duplicate property from the WITH clause so each option appears once.","If using a query builder, deduplicate options before rendering the statement.","Choose one of the conflicting values intentionally and keep only it."],"exampleFix":"-- before\nCREATE KEYSPACE ks WITH replication = {...} AND replication = {...};\n-- after\nCREATE KEYSPACE ks WITH replication = {'class':'SimpleStrategy','replication_factor':3};","handlingStrategy":"validation","validationCode":"Set<String> seen = new HashSet<>();\nfor (String opt : withClauseOptions) { if (!seen.add(opt)) throw new IllegalStateException(\"duplicate property \" + opt); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Deduplicate options when building queries programmatically","Review copy-pasted WITH clauses","Use IF NOT EXISTS-style tooling that renders each option once"],"tags":["cql","syntax","duplicate-property"],"backgroundTag":"conflicting-config-options","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"}