{"record":{"id":"05943b488b0cc633","repo":"apache/cassandra","slug":"cannot-set-transactional-migration-on-new-tables","errorCode":null,"errorMessage":"Cannot set transactional migration on new tables (%s.%s), %s","messagePattern":"Cannot set transactional migration on new tables \\((.+?)\\.(.+?)\\), (.+?)","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/schema/CreateTableStatement.java","lineNumber":196,"sourceCode":"\n        if (keyspace.replicationStrategy.hasTransientReplicas()\n            && table.params.readRepair != ReadRepairStrategy.NONE)\n        {\n            throw ire(\"read_repair must be set to 'NONE' for transiently replicated keyspaces\");\n        }\n\n        if (!table.params.compression.isEnabled() && !SchemaConstants.isSystemKeyspace(table.keyspace))\n            Guardrails.uncompressedTablesEnabled.ensureEnabled(state);\n\n        if (table.params.transactionalMode.accordIsEnabled && SchemaConstants.isSystemKeyspace(keyspaceName))\n            throw ire(\"Cannot enable accord on system tables (%s.%s)\", keyspaceName, tableName);\n\n        if (table.params.transactionalMode.accordIsEnabled && !DatabaseDescriptor.getAccordTransactionsEnabled())\n            throw ire(format(\"Cannot create table %s.%s with transactional mode %s with accord.enabled set to false\",\n                             keyspaceName, tableName, table.params.transactionalMode));\n\n        if (table.params.transactionalMigrationFrom.isMigrating())\n            throw ire(\"Cannot set transactional migration on new tables (%s.%s), %s\", keyspaceName, tableName, table.params.transactionalMigrationFrom);\n\n        return schema.withAddedOrUpdated(keyspace.withSwapped(keyspace.tables.with(table)));\n    }\n\n    @Override\n    public void validate(ClientState state)\n    {\n        super.validate(state);\n\n        // If a memtable configuration is specified, validate it against config\n        if (attrs.hasOption(TableParams.Option.MEMTABLE))\n            MemtableParams.get(attrs.getString(TableParams.Option.MEMTABLE.toString()));\n\n        // Guardrail on table properties\n        Guardrails.tableProperties.guard(attrs.updatedProperties(), attrs::removeProperty, state);\n\n        // Guardrail on columns per table\n        Guardrails.columnsPerTable.guard(rawColumns.size(), tableName, false, state);","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/schema/CreateTableStatement.java#L178-L214","documentation":"CREATE TABLE included a transactional_migration_from setting, but migration of an existing table's transactional mode only makes sense on tables that already exist. New tables cannot start in a migrating state, so Cassandra rejects the DDL.","triggerScenarios":"`CREATE TABLE ... WITH transactional_migration_from = 'disabled'` (any isMigrating() value such as migrating_to_full) on a brand-new table.","commonSituations":"Copying ALTER TABLE transactional-migration syntax from an Accord migration runbook into a CREATE TABLE statement; scripted DDL generation that emits migration clauses for both CREATE and ALTER.","solutions":["Remove the transactional_migration_from clause from the CREATE TABLE statement","Create the table normally, then use ALTER TABLE ... to perform the transactional mode migration"],"exampleFix":"// before\nCREATE TABLE ks.t (k int PRIMARY KEY) WITH transactional_migration_from = 'disabled';\n// after\nCREATE TABLE ks.t (k int PRIMARY KEY);\nALTER TABLE ks.t WITH transactional_migration_from = 'disabled';","handlingStrategy":"validation","validationCode":"if (ddl.contains(\"transactional_migration_from\") && ddl.trim().toUpperCase().startsWith(\"CREATE TABLE\")) throw new IllegalArgumentException(\"transactional_migration_from is only valid on ALTER TABLE\");","typeGuard":null,"tryCatchPattern":"try { session.execute(ddl); } catch (InvalidRequestException e) { if (e.getMessage().contains(\"transactional migration on new tables\")) { /* strip the clause and retry */ } else throw e; }","preventionTips":["Use transactional_migration_from only in ALTER TABLE statements","Separate migration scripts from creation scripts in schema tooling","Review generated DDL for ALTER-only clauses"],"tags":["cql","accord","schema"],"backgroundTag":"invalid-argument-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"}