apache/cassandra · error · InvalidRequestException
Altering column types is no longer supported
Error message
Altering column types is no longer supported
What it means
ALTER TABLE ... ALTER columnname TYPE ... (changing a column's type) is no longer supported in modern Cassandra. The AlterTableStatement.TypeChange.apply is a stub that unconditionally throws this InvalidRequestException regardless of input.
Solutions
- Remove the ALTER TYPE statement; migrate data manually instead: add a new column of the desired type, backfill, then drop the old column
- Recreate the table with correct types and copy data (e.g. via COPY or a Spark job)
- Validate client drivers/ORMs do not emit ALTER ... TYPE during upgrades
Example fix
// before
session.execute("ALTER TABLE my_app.events ALTER payload TYPE blob");
// after
session.execute("ALTER TABLE my_app.events ADD payload_v2 blob");
// backfill payload_v2 from payload, then: ALTER TABLE my_app.events DROP payload; Defensive patterns
Strategy: validation
Validate before calling
if (alterStmt.trim().toLowerCase().matches("alter table \\S+ alter \\S+ type \\S+"))
throw new UnsupportedOperationException("Column type changes are unsupported; migrate data manually"); Try / catch
try {
session.execute(alter);
} catch (InvalidRequestException e) {
if (e.getMessage().equals("Altering column types is no longer supported"))
log.error("Rewrite migration: use add-new-column + backfill + drop-old-column");
else throw e;
} Prevention
- Replace ALTER TYPE in legacy scripts with add/backfill/drop pattern
- Audit ORM/driver-generated DDL for ALTER ... TYPE
- Test old migrations against modern Cassandra versions before rollout
When it happens
Trigger: Executing 'ALTER TABLE ks.tbl ALTER col TYPE <newtype>' — the legacy type-change syntax; any code path mapped to the TypeChange sub-statement fires this on apply
Common situations: Upgrading from very old Cassandra (0.7/1.x era where type changes were briefly allowed); porting legacy migration scripts; following outdated tutorials or ORM-generated DDL that emits ALTER TYPE.
Understand the failure class
Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.
Related errors
- ACCESS TO DATACENTERS operations not supported by…
- Cannot add a counter column to Accord table
- Cannot add new column to a COMPACT STORAGE table
- Cannot drop a table when materialized views still depend on…
- Cannot use ALTER TABLE on a materialized view; use ALTER…
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/44ac7f05eec444d2.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/cql3/statements/schema/AlterTableStatement.java:180
}
abstract KeyspaceMetadata apply(Epoch epoch, KeyspaceMetadata keyspace, TableMetadata table, ClusterMetadata metadata);
/**
* {@code ALTER TABLE [IF EXISTS] <table> ALTER <column> TYPE <newtype>;}
*
* No longer supported.
*/
public static class AlterColumn extends AlterTableStatement
{
AlterColumn(String keyspaceName, String tableName, boolean ifTableExists)
{
super(keyspaceName, tableName, ifTableExists);
}
public KeyspaceMetadata apply(Epoch epoch, KeyspaceMetadata keyspace, TableMetadata table, ClusterMetadata metadata)
{
throw ire("Altering column types is no longer supported");
}
@Override
public boolean compatibleWith(ClusterMetadata metadata)
{
return metadata.directory.commonSerializationVersion.isAtLeast(Version.V0);
}
}
/**
* {@code ALTER TABLE [IF EXISTS] <table> ALTER [IF EXISTS] <column> ( MASKED WITH <newMask> | DROP MASKED )}
*/
public static class MaskColumn extends AlterTableStatement
{
private final ColumnIdentifier columnName;
@Nullable
private final ColumnMask.Raw rawMask;
private final boolean ifColumnExists;View on GitHub (pinned to 88fd0f6a0e)