{"record":{"id":"3920ab65f0cbb8c1","repo":"apache/cassandra","slug":"cannot-change-transactional-mode-to-s-for-s-s-w","errorCode":null,"errorMessage":"Cannot change transactional mode to %s for %s.%s with accord.enabled set to false","messagePattern":"Cannot change transactional mode to (.+?) for (.+?)\\.(.+?) with accord\\.enabled set to false","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/schema/AlterTableStatement.java","lineNumber":656,"sourceCode":"\n        private TableParams validateAndUpdateTransactionalMigration(boolean isCounter, TableParams prev, TableParams next)\n        {\n            if (next.transactionalMode.accordIsEnabled && SchemaConstants.isSystemKeyspace(keyspaceName))\n                throw ire(\"Cannot enable accord on system tables (%s.%s)\", keyspaceName, tableName);\n\n            boolean modeChange = prev.transactionalMode != next.transactionalMode;\n            boolean wasMigrating = prev.transactionalMigrationFrom.isMigrating();\n            boolean explicitlySetMigrationFrom = attrs.hasOption(Option.TRANSACTIONAL_MIGRATION_FROM);\n            // set table to migrating\n            TransactionalMigrationFromMode newMigrateFrom = TransactionalMigrationFromMode.fromMode(prev.transactionalMode, next.transactionalMode);\n\n            if (isCounter && (next.transactionalMode != TransactionalMode.off || newMigrateFrom != TransactionalMigrationFromMode.none || next.transactionalMigrationFrom != TransactionalMigrationFromMode.none))\n                throw ire(format(ACCORD_COUNTER_TABLES_UNSUPPORTED, keyspaceName, tableName));\n\n            boolean forceMigrationChange = modeChange && explicitlySetMigrationFrom && next.transactionalMigrationFrom != newMigrateFrom;\n\n            if (modeChange && next.transactionalMode.accordIsEnabled && !DatabaseDescriptor.getAccordTransactionsEnabled())\n                throw ire(format(\"Cannot change transactional mode to %s for %s.%s with accord.enabled set to false\",\n                                 next.transactionalMode, keyspaceName, tableName));\n\n            // user is manually updating migration mode, don't interfere\n            if (forceMigrationChange)\n            {\n                logger.warn(\"Forcing unsafe migration change from {} to {} with transaction mode {}\", prev.transactionalMigrationFrom, next.transactionalMigrationFrom, next.transactionalMode);\n                return next;\n            }\n\n            if (!modeChange)\n                return next;\n\n            // if the user is trying to revert to the mode being migrated from, allow it. The migration states will be inverted when\n            // the transformation is applied. Otherwise throw\n            if (wasMigrating && next.transactionalMode != prev.transactionalMigrationFrom.from)\n                throw ire(format(\"Cannot change transactional mode from %s to %s for %s.%s before transactional migration has completed\",\n                                 prev.transactionalMode, next.transactionalMode,\n                                 keyspaceName, tableName));","sourceCodeStart":638,"sourceCodeEnd":674,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/schema/AlterTableStatement.java#L638-L674","documentation":"Switching a table to an Accord-enabled transactional mode requires the node flag accord.enabled to be true. When the mode actually changes and the target mode has Accord enabled but DatabaseDescriptor.getAccordTransactionsEnabled() is false, validateAndUpdateTransactionalMigration (AlterTableStatement.java:656) throws this InvalidRequest.","triggerScenarios":"ALTER TABLE ... WITH transactional_mode = 'accord' (or migrating mode) while cassandra.yaml does not set accord_enabled: true (node started without Accord transactions enabled).","commonSituations":"Testing Accord in an environment where the feature flag was never enabled; rolling out a migration script to a cluster that lacks the config; upgrade where the flag defaults to false.","solutions":["Enable accord_enabled: true in cassandra.yaml (and restart/apply config) on all nodes before altering the mode","Use a transactional_mode that does not require Accord (e.g. 'off') until the cluster is configured","Verify the flag via JMX/nodetool or DatabaseDescriptor before running the schema change"],"exampleFix":"// before (cassandra.yaml)\n# accord_enabled not set\n// after (cassandra.yaml)\naccord_enabled: true\n// then\nALTER TABLE my_app.orders WITH transactional_mode = 'accord';","handlingStrategy":"validation","validationCode":"boolean accordEnabled = DatabaseDescriptor.getAccordTransactionsEnabled(); // or check node config/JMX; if (!accordEnabled) { /* do not emit accord mode changes; enable flag first */ }","typeGuard":null,"tryCatchPattern":"try { session.execute(alterStmt); } catch (InvalidRequestException e) { if (e.getMessage().contains(\"with accord.enabled set to false\")) { /* enable accord_enabled in cassandra.yaml, then retry */ } else throw e; }","preventionTips":["Verify accord_enabled: true on every node before migration scripts run","Add environment readiness checks to deployment pipelines","Document the feature flag as a prerequisite for Accord adoption"],"tags":["cassandra","accord","feature-flag","configuration","transactional-mode"],"backgroundTag":"feature-not-enabled","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"}