{"record":{"id":"7311c904253a6bc8","repo":"apache/cassandra","slug":"dynamic-message-from-tableparams-validate-fail","errorCode":null,"errorMessage":"(dynamic message from TableParams.validate fail())","messagePattern":"\\(dynamic message from TableParams\\.validate fail\\(\\)\\)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/schema/TableParams.java","lineNumber":267,"sourceCode":"                 minIndexInterval,\n                 maxIndexInterval);\n        }\n\n        if (memtableFlushPeriodInMs < 0)\n            fail(\"%s must be greater than or equal to 0 (got %s)\", MEMTABLE_FLUSH_PERIOD_IN_MS, memtableFlushPeriodInMs);\n\n        if (cdc && memtable.factory().writesShouldSkipCommitLog())\n            fail(\"CDC cannot work if writes skip the commit log. Check your memtable configuration.\");\n\n        if (transactionalMode.isTestMode() && !CassandraRelevantProperties.ACCORD_ALLOW_TEST_MODES.getBoolean())\n            fail(\"Transactional mode \" + transactionalMode + \" can't be used if \" + CassandraRelevantProperties.ACCORD_ALLOW_TEST_MODES.getKey() + \" is not set\");\n\n        autoRepair.validate();\n    }\n\n    private static void fail(String format, Object... args)\n    {\n        throw new ConfigurationException(format(format, args));\n    }\n\n    @Override\n    public boolean equals(Object o)\n    {\n        if (this == o)\n            return true;\n\n        if (!(o instanceof TableParams))\n            return false;\n\n        TableParams p = (TableParams) o;\n\n        return comment.equals(p.comment)\n            && securityLabel.equals(p.securityLabel)\n            && additionalWritePolicy.equals(p.additionalWritePolicy)\n            && allowAutoSnapshot == p.allowAutoSnapshot\n            && bloomFilterFpChance == p.bloomFilterFpChance","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/schema/TableParams.java#L249-L285","documentation":"TableParams.validate reports invalid table option combinations/values via fail(), which throws ConfigurationException with a formatted message. Covers all validation of table properties (caching, compaction, compression, gc_grace_seconds, transactional/autoRepair settings, etc.).","triggerScenarios":"Creating or altering a table whose WITH options yield invalid TableParams — e.g. negative gc_grace_seconds, invalid caching keys, contradictory compaction options, or unsupported transactionalMode/autoRepair combinations — reaching the fail(...) call at TableParams.java:267.","commonSituations":"Typos or wrong value types in WITH table options; copying options between Cassandra versions with different valid ranges; tools generating conflicting option sets; enabling transactional (Accord) mode with incompatible settings.","solutions":["Read the formatted ConfigurationException message — it names the exact invalid option/value","Correct the offending option in the CREATE/ALTER TABLE statement","Validate options against the documentation for your Cassandra version","Remove conflicting options so only a mutually valid combination remains"],"exampleFix":"// before\nALTER TABLE my_ks.t WITH gc_grace_seconds = -100;\n// after\nALTER TABLE my_ks.t WITH gc_grace_seconds = 864000;","handlingStrategy":"validation","validationCode":"// Pre-validate option values: e.g.\nif (gcGraceSeconds < 0) throw new IllegalArgumentException(\"gc_grace_seconds must be >= 0\");","typeGuard":null,"tryCatchPattern":"try { schemaChange(alterTableCql); } catch (ConfigurationException e) { throw new TableConfigException(\"Invalid table option: \" + e.getMessage(), e); }","preventionTips":["Validate WITH options against the version's TableParams whitelist","Avoid copying raw option maps between Cassandra versions","Lint generated DDL for negative or out-of-range option values","Test ALTER statements on a staging cluster"],"tags":["cassandra","table-params","validation"],"backgroundTag":"invalid-config-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"}