apache/cassandra · error · InvalidRequestException
Undefined column name
Error message
Undefined column name %s in table %s
What it means
Thrown as an InvalidRequestException by TableMetadata.getExistingColumn when no non-hidden column with the given identifier exists in the table. It surfaces invalid column references (in SELECT, INSERT, index definitions, etc.) as clear user errors.
Solutions
- Check the column name against DESCRIBE TABLE / system_schema.columns for the table
- Correct the spelling or casing of the column identifier
- Refresh schema agreement if the client's schema metadata is stale after an ALTER
- Re-prepare statements after schema changes
Example fix
// before SELECT usr_name FROM my_ks.users WHERE id = ?; // after SELECT user_name FROM my_ks.users WHERE id = ?;
Defensive patterns
Strategy: validation
Validate before calling
ColumnMetadata col = tableMetadata.getColumn(ColumnIdentifier.getInternedIdentifier(name)); if (col == null) throw new IllegalArgumentException("Unknown column " + name + " in " + tableMetadata); Type guard
null
Try / catch
try { ColumnMetadata c = table.getExistingColumn(identifier); ... } catch (InvalidRequestException e) { throw new QueryValidationError(e.getMessage(), e); } Prevention
- Validate column names against system_schema.columns before executing
- Keep client-side schema metadata in sync (check schema agreement)
- Re-prepare statements after ALTER/DROP operations
- Use a query builder that validates against fetched TableMetadata
When it happens
Trigger: Calling getExistingColumn/getColumnMetadata/getColumnsMetadata with a ColumnIdentifier that does not match any column in the table — typically from query validation of a CQL statement referencing a misspelled or nonexistent column.
Common situations: Typo in a column name in a CQL query; querying a column that exists only in another table/schema version; referencing a column after a schema change that dropped it; stale prepared statements after DROP of a column.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- ACCESS TO DATACENTERS operations not supported by…
- aggregate functions cannot be used as arguments of…
- allowFilteringMessage(state)
- Altering column types is no longer supported
- Altering field types is no longer supported
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/b89945aa940d6af4.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/schema/TableMetadata.java:540
}
/**
* Returns the column of the provided name if it exists, but throws a user-visible exception if that column doesn't
* exist.
*
* <p>This method is for finding columns from a name provided by the user, and as such it does _not_ returne hidden
* columns (throwing that the column is unknown instead).
*
* @param name the name of an existing non-hidden column of this table.
* @return the column metadata corresponding to {@code name}.
*
* @throws InvalidRequestException if there is no non-hidden column named {@code name} in this table.
*/
public ColumnMetadata getExistingColumn(ColumnIdentifier name)
{
ColumnMetadata def = getColumn(name);
if (def == null)
throw new InvalidRequestException(format(UNDEFINED_COLUMN_NAME_MESSAGE, name.toCQLString(), this));
return def;
}
/*
* In general it is preferable to work with ColumnIdentifier to make it
* clear that we are talking about a CQL column, not a cell name, but there
* is a few cases where all we have is a ByteBuffer (when dealing with IndexExpression
* for instance) so...
*/
public ColumnMetadata getColumn(ByteBuffer name)
{
return columns.get(name);
}
public ColumnMetadata getColumnById(int uniqueId)
{
return columnsById[uniqueId];
}
View on GitHub (pinned to 88fd0f6a0e)