apache/cassandra · error · ConfigurationException
Cannot alter table id.
Error message
Cannot alter table id.
What it means
A table's id is its immutable unique identifier (TableId). TableAttributes.asAlteredTableParams() rejects any ALTER TABLE that tries to change the `id` table attribute, throwing ConfigurationException, because altering it would break references (hints, schema history, etc.).
Source
Thrown at src/java/org/apache/cassandra/cql3/statements/schema/TableAttributes.java:99
public void validate()
{
validate(validKeywords, obsoleteKeywords);
build(TableParams.builder()).validate();
}
TableParams asNewTableParams(String keyspaceName)
{
TableParams.Builder builder = TableParams.builder();
if (!hasOption(TRANSACTIONAL_MODE) && !SchemaConstants.isSystemKeyspace(keyspaceName) && Schema.instance.distributedKeyspaces().names().contains(keyspaceName))
builder.transactionalMode(DatabaseDescriptor.defaultTransactionalMode());
return build(builder);
}
TableParams asAlteredTableParams(TableParams previous)
{
if (getId() != null)
throw new ConfigurationException("Cannot alter table id.");
return build(previous.unbuild());
}
public TableId getId() throws ConfigurationException
{
String id = getString(ID);
try
{
return id != null ? TableId.fromString(id) : null;
}
catch (IllegalArgumentException e)
{
throw new ConfigurationException("Invalid table id", e);
}
}
public static Set<String> validKeywords()
{View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Remove the id option from the ALTER TABLE statement
- To get a new table id, recreate the table and copy the data (e.g. INSERT/COPY or a new CREATE TABLE + migration)
Example fix
// before ALTER TABLE ks.t WITH id = '1a2b3c4d-0000-4000-8000-000000000000'; // after ALTER TABLE ks.t WITH comment = 'metadata update'; -- drop the id option
Defensive patterns
Strategy: validation
Validate before calling
function validateAlterTable(attrs) {
if (attrs && attrs.id !== undefined) throw new Error('Table id is immutable; remove it from ALTER TABLE');
} Prevention
- Never include id in ALTER TABLE attribute sets
- When copying CREATE TABLE options, strip the id attribute
- To change a table id, create a new table and migrate data
When it happens
Trigger: ALTER TABLE t WITH id = 'xxxxxxxx-....' — the id attribute present on an ALTER statement.
Common situations: Attempting to 're-link' a table after restore/clone; copying full CREATE TABLE options (including id) into an ALTER; migration tooling rewriting ids.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- REVOKE operation is not supported by AllowAllAuthorizer
- Key may not be empty
- Key may not be empty
- Key length of %d is longer than maximum of %d
- Column value does not satisfy value constraint for column '<
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/ccc56c0d118d9fc1.
Report an issue: GitHub.