{"record":{"id":"40aa8cb1c8b0fa0b","repo":"influxdata/influxdb","slug":"requested-last-cache-does-not-exist","errorCode":null,"errorMessage":"requested last cache does not exist","messagePattern":"requested last cache does not exist","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"influxdb3_cache/src/last_cache/mod.rs","lineNumber":34,"sourceCode":"    #[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":16,"sourceCodeEnd":48,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_cache/src/last_cache/mod.rs#L16-L48","documentation":"This is the `CacheDoesNotExist` variant of the last_cache `Error` enum in influxdb3_cache. It is returned when an operation (e.g. reading, deleting, or altering a last-value cache) references a last cache by name/table but no such cache is registered in the catalog. The library throws it instead of silently returning empty results so callers can distinguish 'cache missing' from 'cache empty'.","triggerScenarios":"Calling a last-cache API (get/read/alter/delete cache) with a table+cache name combination that was never created via `CREATE LAST CACHE`, or referencing a cache that was already dropped or was lost because the node was restarted without cache persistence.","commonSituations":"Typo in the cache or table name in SQL like `ALTER LAST CACHE ...`; querying a cache after a `DROP LAST CACHE` ran in another session; referencing caches from a different node's spec in multi-node setups; upgrade/restart wiped in-memory caches.","solutions":["List existing last caches (e.g. via catalog/`information_schema` or SHOW) and confirm the exact table and cache name you reference.","Create the cache first with `CREATE LAST CACHE <table> ...` before reading or altering it.","Fix the typo or wrong table name in the statement or API call.","If caches should survive restarts, enable/verify last-cache persistence configuration instead of relying on in-memory state."],"exampleFix":"// before\nclient.get_last_cache(\"cpu\", \"cache_typo\")?; // Error::CacheDoesNotExist\n// after\nlet caches = client.list_last_caches(\"cpu\")?;\nif caches.iter().any(|c| c.name == \"cache_typo\") {\n    client.get_last_cache(\"cpu\", \"cache_typo\")?;\n} else {\n    client.create_last_cache(\"cpu\", \"cache_typo\", /* key/value columns */)?;\n}","handlingStrategy":"validation","validationCode":"// Rust-ish pseudo-check before reading/altering a cache\nlet exists = catalog.list_last_caches(table)?.iter().any(|c| c.name == cache_name);\nif !exists { return Err(anyhow!(\"last cache '{}' on table '{}' does not exist\", cache_name, table)); }","typeGuard":"fn cache_exists(caches: &[LastCacheInfo], table: &str, name: &str) -> bool {\n    caches.iter().any(|c| c.table == table && c.name == name)\n}","tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"requested last cache does not exist\") => create_or_recreate_cache(),\n    other => other?,\n}","preventionTips":["List caches before referencing them; never hardcode cache names in tooling.","Use idempotent create-or-alter flows instead of assuming a cache exists.","Enable last-cache persistence if caches must survive restarts.","Match exact table and cache names (case-sensitive)."],"tags":["influxdb3","last-cache","resource-not-found","rust"],"backgroundTag":"resource-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"}