{"record":{"id":"e7acfc02b44ad60c","repo":"influxdata/influxdb","slug":"column-id-in-series-key-should-be-valid","errorCode":null,"errorMessage":"column id in series key should be valid","messagePattern":"column id in series key should be valid","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"influxdb3_catalog/src/catalog/versions/v2/update.rs","lineNumber":954,"sourceCode":"                                    )\n                                    .as_str(),\n                                )\n                            })\n                            .and_then(|def| {\n                                if is_valid_last_cache_key_col(&def) {\n                                    Ok((def.id(), name.as_ref().to_string()))\n                                } else {\n                                    Err(CatalogError::InvalidLastCacheKeyColumnType)\n                                }\n                            })\n                    })\n                    .collect::<Result<(Vec<ColumnIdentifier>, Vec<String>)>>()?\n            } else {\n                tbl.series_key\n                    .iter()\n                    .map(|id| {\n                        tbl.column_definition_by_id(&ColumnIdentifier::tag(*id))\n                            .expect(\"column id in series key should be valid\")\n                    })\n                    .map(|def| Ok((def.id(), def.name().to_string())))\n                    .collect::<Result<(Vec<ColumnIdentifier>, Vec<String>)>>()?\n            };\n\n            let value_columns = if let Some(value_columns) = value_columns {\n                let columns = value_columns\n                    .iter()\n                    .map(|name| {\n                        tbl.column_definition(name.as_ref())\n                            .map(|def| def.id())\n                            .ok_or_else(|| {\n                                CatalogError::invalid_configuration(\n                                    format!(\n                                        \"invalid value column provided: {name}\",\n                                        name = name.as_ref()\n                                    )\n                                    .as_str(),","sourceCodeStart":936,"sourceCodeEnd":972,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_catalog/src/catalog/versions/v2/update.rs#L936-L972","documentation":"A `.expect(...)` panic in the catalog's `create_last_cache` update path: when value/key columns are not explicitly given, the cache key columns are derived from the table's `series_key` column ids, and each id is looked up in `column_definition_by_id`. The assertion states every series-key column id must have a definition; a lookup miss means the table's series_key references a column that does not exist in its own definition map.","triggerScenarios":"Calling `create_last_cache` without explicit key columns on a table whose `series_key` contains a column id missing from `column_definition_by_id` — i.e. catalog inconsistency (stale/dangling series_key after a column drop or partial schema update).","commonSituations":"Catalogs mutated by older/buggy versions that dropped columns without cleaning series_key; hand-restored or merged catalog snapshots; migrations that rebuilt column maps but not series keys.","solutions":["Pass explicit `key_columns` to `create_last_cache` so the series-key derivation path (and its fragile lookup) is skipped.","Inspect the table's schema in the catalog and repair/remove the dangling series_key entry referencing the missing column id.","Restore the affected table/catalog from a consistent backup.","Replace the `expect` with a proper error (e.g. `KeyColumnDoesNotExistByName`) so create_last_cache fails gracefully on inconsistent schemas."],"exampleFix":"// before\n.expect(\"column id in series key should be valid\")\n// after\n.ok_or_else(|| anyhow!(\"series key references missing column id {}\", ColumnIdentifier::tag(*id)))?","handlingStrategy":"validation","validationCode":"// verify every series_key id resolves before calling create_last_cache without key_columns\nfor id in &table.series_key {\n    assert!(\n        table.column_definition_by_id(&ColumnIdentifier::tag(*id)).is_some(),\n        \"series_key references missing column id {id}\"\n    );\n}","typeGuard":"fn series_key_resolves(tbl: &TableSnapshot) -> bool {\n    tbl.series_key.iter().all(|id| tbl.column_definition_by_id(&ColumnIdentifier::tag(*id)).is_some())\n}","tryCatchPattern":"// panic path; pass explicit key columns when the schema is suspect\nif !series_key_resolves(&tbl) {\n    create_last_cache(table, /* explicit key_columns */, value_columns)?;\n}","preventionTips":["Pass explicit key_columns to create_last_cache instead of relying on series-key derivation.","After dropping columns, verify series_key was updated to remove the dropped ids.","Restore catalogs from consistent snapshots, never hand-merge table definitions.","Audit table schemas (series_key vs column map) after upgrades or restores."],"tags":["influxdb3","catalog","last-cache","schema","panic","rust"],"backgroundTag":"entity-not-found","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"}