{"record":{"id":"9b7be6271e3ef861","repo":"influxdata/influxdb","slug":"specified-key-column-name-column-name-does-not-exist-in-the","errorCode":null,"errorMessage":"specified key column (name: {column_name}) does not exist in the table schema","messagePattern":"specified key column \\(name: (.+?)\\) does not exist in the table schema","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"influxdb3_cache/src/last_cache/mod.rs","lineNumber":28,"sourceCode":"mod table_function;\nuse schema::InfluxColumnType;\npub use table_function::{LAST_CACHE_UDTF_NAME, LastCacheFunction};\n\n#[derive(Debug, thiserror::Error)]\npub enum Error {\n    #[error(\"invalid cache size\")]\n    InvalidCacheSize,\n    #[error(\n        \"last cache already exists for database and table, but it was configured differently: {reason}\"\n    )]\n    CacheAlreadyExists { reason: String },\n    #[error(\"specified column (name: {column_name}) does not exist in the table definition\")]\n    ColumnDoesNotExistByName { column_name: String },\n    #[error(\"specified column (id: {column_id}) does not exist in the table definition\")]\n    ColumnDoesNotExistById { column_id: ColumnId },\n    #[error(\"specified key column (id: {column_id}) does not exist in the table schema\")]\n    KeyColumnDoesNotExist { column_id: ColumnId },\n    #[error(\"specified key column (name: {column_name}) does not exist in the table schema\")]\n    KeyColumnDoesNotExistByName { column_name: String },\n    #[error(\"key column must be string, int, uint, or bool types, got: {column_type}\")]\n    InvalidKeyColumn { column_type: InfluxColumnType },\n    #[error(\"specified value column ({column_id}) does not exist in the table schema\")]\n    ValueColumnDoesNotExist { column_id: ColumnId },\n    #[error(\"requested last cache does not exist\")]\n    CacheDoesNotExist,\n}\n\nimpl Error {\n    fn cache_already_exists(reason: impl Into<String>) -> Self {\n        Self::CacheAlreadyExists {\n            reason: reason.into(),\n        }\n    }\n}\n\n#[cfg(test)]","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_cache/src/last_cache/mod.rs#L10-L46","documentation":"This is the `KeyColumnDoesNotExistByName` variant of the last-cache `Error` enum. It is raised when a column given by name as a key column for a last-of-value cache does not exist in the table's schema. The cache validates every named key column against the table definition at cache-creation time and rejects unknown names.","triggerScenarios":"Calling `create_last_cache` with `key_columns` containing a misspelled or non-existent column name; naming a field that exists in another table but not the target table; referencing a tag/field removed by a schema change.","commonSituations":"Typos or case mismatches in column names in cache configuration; renaming a tag column without updating last-cache configs; copying cache definitions between tables with different schemas.","solutions":["List the table's actual columns and correct the key column name spelling/case","Remove the invalid name from the `key_columns` list, or create the column first","Align cache configs with the schema after any column renames"],"exampleFix":"// before\ncreate_last_cache(db, \"sensors\", \"latest\", Some(&[\"lokation\"]), None, 10, None);\n// after\ncreate_last_cache(db, \"sensors\", \"latest\", Some(&[\"location\"]), None, 10, None);","handlingStrategy":"validation","validationCode":"fn valid_key_names(schema: &Schema, names: &[&str]) -> Result<(), String> {\n    names.iter()\n        .find(|n| schema.field_name_to_id(n).is_err())\n        .map_or(Ok(()), |n| Err(format!(\"key column '{n}' not found\")))\n}","typeGuard":"fn key_column_named(schema: &Schema, name: &str) -> Option<ColumnId> {\n    schema.field_name_to_id(name).ok()\n}","tryCatchPattern":"match res {\n    Err(LastCacheError::KeyColumnDoesNotExistByName { column_name }) => {\n        eprintln!(\"unknown key column '{column_name}'; check spelling against table schema\");\n    }\n    Err(e) => return Err(e.into()),\n    Ok(_) => {}\n}","preventionTips":["Spell-check key column names against the table schema before configuring","Keep cache config files in sync with schema migrations/renames","Verify case-sensitivity: InfluxDB column names are case-sensitive"],"tags":["influxdb3","last-cache","schema","key-column"],"backgroundTag":"schema-validation-failed","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}