apache/cassandra · error · InvalidRequestException

Cannot change transactional mode to %s for %s.%s with accord

Error message

Cannot change transactional mode to %s for %s.%s with accord.enabled set to false

What it means

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.

Source

Thrown at src/java/org/apache/cassandra/cql3/statements/schema/AlterTableStatement.java:656

        private TableParams validateAndUpdateTransactionalMigration(boolean isCounter, TableParams prev, TableParams next)
        {
            if (next.transactionalMode.accordIsEnabled && SchemaConstants.isSystemKeyspace(keyspaceName))
                throw ire("Cannot enable accord on system tables (%s.%s)", keyspaceName, tableName);

            boolean modeChange = prev.transactionalMode != next.transactionalMode;
            boolean wasMigrating = prev.transactionalMigrationFrom.isMigrating();
            boolean explicitlySetMigrationFrom = attrs.hasOption(Option.TRANSACTIONAL_MIGRATION_FROM);
            // set table to migrating
            TransactionalMigrationFromMode newMigrateFrom = TransactionalMigrationFromMode.fromMode(prev.transactionalMode, next.transactionalMode);

            if (isCounter && (next.transactionalMode != TransactionalMode.off || newMigrateFrom != TransactionalMigrationFromMode.none || next.transactionalMigrationFrom != TransactionalMigrationFromMode.none))
                throw ire(format(ACCORD_COUNTER_TABLES_UNSUPPORTED, keyspaceName, tableName));

            boolean forceMigrationChange = modeChange && explicitlySetMigrationFrom && next.transactionalMigrationFrom != newMigrateFrom;

            if (modeChange && next.transactionalMode.accordIsEnabled && !DatabaseDescriptor.getAccordTransactionsEnabled())
                throw ire(format("Cannot change transactional mode to %s for %s.%s with accord.enabled set to false",
                                 next.transactionalMode, keyspaceName, tableName));

            // user is manually updating migration mode, don't interfere
            if (forceMigrationChange)
            {
                logger.warn("Forcing unsafe migration change from {} to {} with transaction mode {}", prev.transactionalMigrationFrom, next.transactionalMigrationFrom, next.transactionalMode);
                return next;
            }

            if (!modeChange)
                return next;

            // if the user is trying to revert to the mode being migrated from, allow it. The migration states will be inverted when
            // the transformation is applied. Otherwise throw
            if (wasMigrating && next.transactionalMode != prev.transactionalMigrationFrom.from)
                throw ire(format("Cannot change transactional mode from %s to %s for %s.%s before transactional migration has completed",
                                 prev.transactionalMode, next.transactionalMode,
                                 keyspaceName, tableName));

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Enable accord_enabled: true in cassandra.yaml (and restart/apply config) on all nodes before altering the mode
  2. Use a transactional_mode that does not require Accord (e.g. 'off') until the cluster is configured
  3. Verify the flag via JMX/nodetool or DatabaseDescriptor before running the schema change

Example fix

// before (cassandra.yaml)
# accord_enabled not set
// after (cassandra.yaml)
accord_enabled: true
// then
ALTER TABLE my_app.orders WITH transactional_mode = 'accord';
Defensive patterns

Strategy: validation

Validate before calling

boolean accordEnabled = DatabaseDescriptor.getAccordTransactionsEnabled(); // or check node config/JMX; if (!accordEnabled) { /* do not emit accord mode changes; enable flag first */ }

Try / catch

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; }

Prevention

When it happens

Trigger: ALTER TABLE ... WITH transactional_mode = 'accord' (or migrating mode) while cassandra.yaml does not set accord_enabled: true (node started without Accord transactions enabled).

Common situations: 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.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/3920ab65f0cbb8c1. Report an issue: GitHub.