apache/cassandra · error · InvalidRequestException
Column ' ' doesn't exist
Error message
Column '%s' doesn't exist
What it means
Thrown by ALTER TABLE when the column named in the statement does not exist on the target table. Cassandra refuses the schema change unless the IF EXISTS clause for columns is supplied, in which case it becomes a silent no-op. It prevents executing schema alterations against a column identifier that does not match the table schema.
Solutions
- Verify the column exists with `DESCRIBE TABLE ks.t;` or a system_schema.columns query and fix the spelling/casing
- Add `IF EXISTS` to the statement (e.g. `ALTER TABLE ks.t DROP "col" IF EXISTS;`) if a no-op is acceptable
- Check you are connected to the intended keyspace/cluster and that prior migrations that add the column actually ran
Example fix
// before ALTER TABLE users DROP old_email; // after ALTER TABLE users DROP old_email IF EXISTS;
Defensive patterns
Strategy: validation
Validate before calling
boolean exists = session.execute("SELECT column_name FROM system_schema.columns WHERE keyspace_name=? AND table_name=? AND column_name=?", ks, table, col).iterator().hasNext();
if (!exists) throw new IllegalStateException(col + " does not exist on " + ks + "." + table); Type guard
boolean columnExists(Session s, String ks, String table, String col) {
return s.execute("SELECT column_name FROM system_schema.columns WHERE keyspace_name=? AND table_name=? AND column_name=?", ks, table, col).iterator().hasNext();
} Try / catch
try { session.execute(alterStmt); }
catch (InvalidQueryException e) {
if (e.getMessage().startsWith("Column ") && e.getMessage().endsWith("doesn't exist")) {
// log and skip or re-sync schema
} else throw e;
} Prevention
- Check system_schema.columns (or DESCRIBE TABLE) before altering
- Use IF EXISTS when a no-op is acceptable
- Keep migrations idempotent and ordered
- Watch identifier case-sensitivity: quote names only when they were created quoted
When it happens
Trigger: Running `ALTER TABLE ks.t DROP col`, `ALTER TABLE ks.t ALTER col TYPE ...` or similar with a columnName that is absent from the table's schema, without `ifColumnExists` set (i.e. no `IF EXISTS` column clause in the CQL).
Common situations: Typos in the column name; case-sensitivity mistakes (unquoted identifiers are lowercased, quoted ones are not); running migrations against an environment where the column was never added or already dropped; concurrent migrations racing to drop the same column.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- Cannot add a column ' ' of type , incompatible with…
- Cannot drop column on base table with materialized views
- Cannot drop non-frozen column
- Cannot drop PRIMARY KEY column
- Cannot re-add previously dropped column
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/898e6616286b896c.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/cql3/statements/schema/AlterTableStatement.java:862
if (column != null)
{
ColumnConstraints oldConstraints = column.getColumnConstraints();
ColumnConstraints newConstraints = constraints == null ? ColumnConstraints.NO_OP : constraints.prepare(columnName);
if (Objects.equals(oldConstraints, newConstraints))
return keyspace;
newConstraints.validate(column);
TableMetadata.Builder tableBuilder = table.unbuild().epoch(epoch);
tableBuilder.alterColumnConstraints(columnName, newConstraints);
TableMetadata newTable = tableBuilder.build();
newTable.validate();
return keyspace.withSwapped(keyspace.tables.withSwapped(newTable));
}
else
{
if (!ifColumnExists)
throw ire("Column '%s' doesn't exist", columnName);
}
return keyspace;
}
@Override
public boolean compatibleWith(ClusterMetadata metadata)
{
return metadata.directory.commonSerializationVersion.isAtLeast(Version.V5);
}
}
public static final class Raw extends CQLStatement.Raw
{
private enum Kind
{
ALTER_COLUMN,
MASK_COLUMN,
ADD_COLUMNS,View on GitHub (pinned to 88fd0f6a0e)