{"record":{"id":"3a56f7f07a4718e5","repo":"influxdata/influxdb","slug":"unexpected-error-0","errorCode":null,"errorMessage":"unexpected error: {0}","messagePattern":"unexpected error: (.+?)","errorType":"exception","errorClass":"CacheError","httpStatus":null,"severity":"error","filePath":"influxdb3_cache/src/distinct_cache/cache.rs","lineNumber":33,"sourceCode":"use influxdb3_catalog::catalog::{MaxAge, MaxCardinality, TableDefinition};\nuse influxdb3_id::{ColumnId, ColumnIdentifier};\nuse influxdb3_wal::{FieldData, Row};\nuse iox_time::TimeProvider;\nuse observability_deps::tracing::debug;\nuse schema::{InfluxColumnType, InfluxFieldType};\n\n#[derive(Debug, thiserror::Error)]\npub enum CacheError {\n    #[error(\"must pass a non-empty set of column ids\")]\n    EmptyColumnSet,\n    #[error(\n        \"cannot use a column of type {attempted} in a distinct value cache, only \\\n                    tags and string fields can be used\"\n    )]\n    NonTagOrStringColumn { attempted: InfluxColumnType },\n    #[error(\"cannot overwrite an an existing cache: {message}\")]\n    ConfigurationMismatch { message: String },\n    #[error(\"unexpected error: {0}\")]\n    Unexpected(#[from] anyhow::Error),\n}\n\n/// A cache for storing distinct values for a set of columns in a table\n#[derive(Debug)]\npub(crate) struct DistinctCache {\n    time_provider: Arc<dyn TimeProvider>,\n    /// The maximum number of unique value combinations in the cache\n    max_cardinality: usize,\n    /// The maximum age for entries in the cache\n    max_age: Duration,\n    /// The fixed Arrow schema used to produce record batches from the cache\n    schema: SchemaRef,\n    /// Holds current state of the cache\n    pub(crate) state: DistinctCacheState,\n    /// The identifiers of the columns used in the cache\n    column_ids: Vec<ColumnId>,\n    /// The cache data, stored in a tree","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_cache/src/distinct_cache/cache.rs#L15-L51","documentation":"CacheError::Unexpected wraps an anyhow::Error for errors that do not map to a specific cache failure mode, e.g. internal schema/IO issues. It signals a bug or an unexpected environmental failure inside the distinct cache subsystem rather than invalid user input.","triggerScenarios":"Any internal failure while constructing or operating a DistinctCache that surfaces through anyhow, converted automatically via #[from] anyhow::Error.","commonSituations":"Underlying storage/catalog errors, unexpected schema states, or version mismatches inside the server that are not supposed to happen during normal operation.","solutions":["Inspect the wrapped anyhow message/chain (source) to identify the root cause","Retry the operation if the cause was transient; otherwise file an issue with the full error chain","Update the server/clients if a version mismatch is implicated"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// Rust\nmatch provider.new_cache(table_id, cols) {\n    Err(ProviderError::Cache(CacheError::Unexpected(src))) => {\n        error!(error = ?src, \"unexpected distinct cache failure\");\n        // capture src.chain() for the bug report; retry only if transient\n    }\n    other => other,\n}","preventionTips":["Keep server and client versions aligned","Capture and report the full anyhow error chain when this occurs","Treat repeated occurrences as bugs and file an issue"],"tags":["internal","distinct-cache","rust","influxdb3"],"backgroundTag":"internal-invariant-violation","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"}