{"record":{"id":"c7f12b682fef7fbb","repo":"influxdata/influxdb","slug":"specified-value-column-column-id-does-not-exist-in-the-table","errorCode":null,"errorMessage":"specified value column ({column_id}) does not exist in the table schema","messagePattern":"specified value column \\((.+?)\\) does not exist in the table schema","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"influxdb3_cache/src/last_cache/mod.rs","lineNumber":32,"sourceCode":"#[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)]\nmod tests;\n","sourceCodeStart":14,"sourceCodeEnd":48,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_cache/src/last_cache/mod.rs#L14-L48","documentation":"This is the `ValueColumnDoesNotExist` variant of the last-cache `Error` enum. It is raised when a column listed as a value column, referenced by ColumnId, does not exist in the table's schema. Value columns are the fields whose latest values the cache stores, so each id is validated against the table definition before the cache is built.","triggerScenarios":"Calling `create_last_cache` / `create_from_table` with `value_columns` containing a ColumnId not present in the table schema; carrying over value column ids from a dropped and recreated table.","commonSituations":"Stale cached schema metadata after ALTER TABLE; hard-coded value column ids that differ between environments; generating cache configs from an outdated table definition snapshot.","solutions":["Look up fresh ColumnIds from the current table schema by column name before configuring value columns","Correct or remove the invalid id from the `value_columns` list","Re-derive cache configuration after any schema migration"],"exampleFix":"// before\nlet vals = vec![42]; // id not in current schema\ncreate_last_cache(db, tbl, name, Some(keys), Some(vals), count, ttl);\n// after\nlet vals = vec![schema.column_id_by_name(\"humidity\").expect(\"humidity column exists\")];\ncreate_last_cache(db, tbl, name, Some(keys), Some(vals), count, ttl);","handlingStrategy":"validation","validationCode":"fn validate_value_columns(schema: &Schema, ids: &[ColumnId]) -> Result<(), String> {\n    ids.iter().find(|id| schema.field_id(**id).is_none())\n        .map_or(Ok(()), |id| Err(format!(\"value column id {id} not in schema\")))\n}","typeGuard":"fn value_column_exists(schema: &Schema, col_id: ColumnId) -> bool {\n    schema.field_id(col_id).is_some()\n}","tryCatchPattern":"match res {\n    Err(LastCacheError::ValueColumnDoesNotExist { column_id }) => {\n        eprintln!(\"value column id {column_id} missing; refresh ids from schema\");\n    }\n    Err(e) => return Err(e.into()),\n    Ok(_) => {}\n}","preventionTips":["Derive value column ids from the live schema at cache creation time","Name value columns in config and map to ids against the current table definition","Regenerate cache configs after dropping/recreating tables or migrating schemas"],"tags":["influxdb3","last-cache","schema","value-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"}