{"record":{"id":"5a3d3696985c9d53","repo":"influxdata/influxdb","slug":"failed-to-initialize-distinct-cache-0","errorCode":null,"errorMessage":"failed to initialize distinct cache: {0:#}","messagePattern":"failed to initialize distinct cache: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"influxdb3/src/commands/serve.rs","lineNumber":150,"sourceCode":"    #[error(\"Token error: {0}\")]\n    TokenError(CatalogError),\n\n    #[error(\"Write buffer error: {0}\")]\n    WriteBuffer(#[from] influxdb3_write::write_buffer::Error),\n\n    #[error(\"invalid token: {0}\")]\n    InvalidToken(#[from] hex::FromHexError),\n\n    #[error(\"failed to initialize write buffer: {0:?}\")]\n    WriteBufferInit(#[source] anyhow::Error),\n\n    #[error(\"failed to initialize catalog: {0}\")]\n    InitializeCatalog(#[source] CatalogError),\n\n    #[error(\"failed to initialize last cache: {0}\")]\n    InitializeLastCache(#[source] last_cache::Error),\n\n    #[error(\"failed to initialize distinct cache: {0:#}\")]\n    InitializeDistinctCache(#[source] influxdb3_cache::distinct_cache::ProviderError),\n\n    #[error(\"lost backend\")]\n    LostBackend,\n\n    #[error(\"lost HTTP/gRPC service\")]\n    LostHttpGrpc,\n\n    #[error(\"lost admin token recovery service\")]\n    LostAdminTokenRecovery,\n\n    #[error(\"tls requires both a cert and a key file to be passed in to work\")]\n    NoCertOrKeyFile,\n\n    #[error(\"table cache index initialization failed: {0}\")]\n    TableIndexCacheInitialization(\n        #[source] influxdb3_write::table_index_cache::TableIndexCacheError,\n    ),","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3/src/commands/serve.rs#L132-L168","documentation":"Display message of the `Error::InitializeDistinctCache` variant, wrapping an `influxdb3_cache::distinct_cache::ProviderError` (#[source], printed with alternate/pretty {0:#}) from building the distinct-value cache provider at startup. Like the last cache, it is driven by per-table cache specifications.","triggerScenarios":"During serve startup, a distinct cache specification for some table cannot be initialized — e.g. the cached column no longer exists, or the column type is unsupported for a distinct cache.","commonSituations":"Schema drift: the table lost or renamed the column referenced by the distinct cache; max-cardinality/size parameters invalid; cache provider constructed against an incompatible catalog.","solutions":["Inspect the pretty-printed ProviderError ({0:#}) to identify the failing cache","Drop and recreate the distinct cache with columns valid in the current schema","Confirm the cached column's type is supported by the distinct cache","Fix max size/cardinality parameters to accepted ranges"],"exampleFix":"// before\nCREATE DISTINCT CACHE ON \"mytable\"(region) ; -- region column dropped\n// after\nDROP DISTINCT CACHE ON \"mytable\";\nCREATE DISTINCT CACHE ON \"mytable\"(tag1) ; -- existing column of supported type","handlingStrategy":"validation","validationCode":"-- verify distinct cache columns still exist and are supported types\n-- before restarting the server with existing cache specs","typeGuard":null,"tryCatchPattern":"match serve_result {\n    Err(Error::InitializeDistinctCache(src)) => eprintln!(\"distinct cache init failed: {src:#}\"),\n    ...\n}","preventionTips":["Audit distinct cache specs after any schema change","Only cache columns of supported types with bounded cardinality","Drop and recreate caches that reference altered columns"],"tags":["rust","cache","startup","schema"],"backgroundTag":"module-init-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"}