{"record":{"id":"f2e23c8cc896d4b3","repo":"influxdata/influxdb","slug":"error-in-distinct-value-cache-0","errorCode":null,"errorMessage":"error in distinct value cache: {0}","messagePattern":"error in distinct value cache: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"influxdb3_write/src/write_buffer/mod.rs","lineNumber":137,"sourceCode":"    #[error(\"table '{db_name}.{table_name}' already exists\")]\n    TableAlreadyExists {\n        db_name: Arc<str>,\n        table_name: Arc<str>,\n    },\n\n    #[error(\"tried accessing column with name ({0}) that does not exist\")]\n    ColumnDoesNotExist(String),\n\n    #[error(\n        \"updating catalog on delete of last cache failed, you will need to delete the cache \\\n        again on server restart\"\n    )]\n    DeleteLastCache(#[source] CatalogError),\n\n    #[error(\"error from wal: {0}\")]\n    WalError(#[from] influxdb3_wal::Error),\n\n    #[error(\"error in distinct value cache: {0}\")]\n    DistinctCacheError(#[from] distinct_cache::ProviderError),\n\n    #[error(\"cannot write to a compactor-only server\")]\n    NoWriteInCompactorOnly,\n\n    #[error(\"error: {0}\")]\n    AnyhowError(#[from] anyhow::Error),\n\n    #[error(\"write not allowed on internal database\")]\n    InternalDbWriteNotAllowed,\n}\n\npub type Result<T, E = Error> = std::result::Result<T, E>;\n\n#[derive(Debug)]\npub struct WriteRequest<'a> {\n    pub db_name: DatabaseName,\n    pub line_protocol: &'a str,","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_write/src/write_buffer/mod.rs#L119-L155","documentation":"Wraps distinct_cache::ProviderError (#[from]) — a failure in the distinct value cache subsystem used to enforce tag uniqueness constraints. Raised when updating or querying the distinct value cache during writes fails.","triggerScenarios":"A write triggers a distinct-value cache operation (e.g. checking tag value cardinality/uniqueness) and the underlying cache provider errors — memory pressure, lock contention, or internal provider failure.","commonSituations":"High-cardinality tag sets stressing the cache; concurrent writers contending on the cache; bugs or resource limits in the cache provider after long uptimes.","solutions":["Inspect the inner ProviderError for the exact cause","Reduce tag cardinality or drop unneeded tags from the written data","Restart the server to rebuild cache state if it is corrupted","Retry the write once the cache subsystem recovers"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-check cardinality of tag sets before writing\nif estimated_tag_cardinality(tags) > MAX_DISTINCT_VALUES {\n    return Err(\"tag cardinality too high for distinct cache\");\n}","typeGuard":"fn is_distinct_cache_error(err: &WriteBufferError) -> bool {\n    matches!(err, WriteBufferError::DistinctCacheError(_))\n}","tryCatchPattern":"match buffer.write(db, lines) {\n    Err(WriteBufferError::DistinctCacheError(e)) => {\n        eprintln!(\"distinct cache failure: {e}; reduce tag cardinality or retry\");\n    }\n    other => other?,\n}","preventionTips":["Avoid unbounded tag cardinality in written data","Monitor distinct cache size/memory in production","Retry transient cache failures with backoff"],"tags":["distinct-cache","write","influxdb3"],"backgroundTag":"database-write-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"}