{"record":{"id":"118835aa1664bf20","repo":"influxdata/influxdb","slug":"failed-to-deserialize-table-index","errorCode":null,"errorMessage":"Failed to deserialize table index","messagePattern":"Failed to deserialize table index","errorType":"error_code","errorClass":"TableIndexError","httpStatus":null,"severity":"error","filePath":"influxdb3_write/src/table_index.rs","lineNumber":25,"sourceCode":"use observability_deps::tracing::{debug, warn};\nuse serde::{Deserialize, Serialize};\nuse thiserror::Error;\nuse tokio::sync::Semaphore;\n\nuse influxdb3_id::{DbId, ParquetFileId, TableId, TableIndexId};\nuse influxdb3_wal::SnapshotSequenceNumber;\n\nuse crate::{\n    ParquetFile, PersistedSnapshot, PersistedSnapshotVersion,\n    paths::{SnapshotInfoFilePath, TableIndexPath, TableIndexSnapshotPath},\n};\n\n#[derive(Debug, Error)]\npub enum TableIndexError {\n    #[error(\"Failed to load table index from object store\")]\n    LoadIndex(#[source] object_store::Error),\n\n    #[error(\"Failed to deserialize table index\")]\n    SerializeIndex(#[source] serde_json::Error),\n\n    #[error(\"Failed to deserialize table index\")]\n    DeserializeIndex(#[source] serde_json::Error),\n\n    #[error(\"Failed to list table index snapshots from object store\")]\n    ListSnapshots(#[source] object_store::Error),\n\n    #[error(\"Failed to list table indices from object store\")]\n    ListIndices(#[source] object_store::Error),\n\n    #[error(\"Failed to load table index snapshot from object store\")]\n    LoadSnapshot(#[source] object_store::Error),\n\n    #[error(\"Failed to deserialize table index snapshot\")]\n    DeserializeSnapshot(#[source] serde_json::Error),\n\n    #[error(\"Failed to persist table index to object store\")]","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_write/src/table_index.rs#L7-L43","documentation":"TableIndexError::SerializeIndex wraps a serde_json::Error raised when serializing the table index to JSON (despite its message saying \"deserialize\", the SerializeIndex variant wraps to_json calls). If the index structure cannot be converted to JSON (rare for serde-compatible structs, but possible via map keys or custom serde impls) this error is returned before writing to the object store.","triggerScenarios":"Calling the persist path that runs serde_json::to_vec_pretty(&self) on CoreTableIndex/TableIndexSnapshot and maps the error to SerializeIndex (table_index.rs:284).","commonSituations":"Custom serde::Serialize implementations that error (e.g. serializing non-string map keys); instrumentation or forks that inject non-JSON-serializable data into the index struct; memory corruption/bugs in modified builds.","solutions":["Check the #[source] serde_json::Error for the exact serialization failure point","Ensure all fields of the index (table names, snapshot ids) are JSON-compatible types (string keys, no untagged exotic types)","Update InfluxDB3 to a version where index types are known-good serde structs","If a fork added custom fields, fix their Serialize impl or mark them #[serde(skip)]"],"exampleFix":"// before\nstruct CustomIndex { meta: std::collections::HashMap<NonZeroU32, String> } // non-string keys can fail\n// after\n#[derive(serde::Serialize)]\nstruct CustomIndex { meta: std::collections::HashMap<String, String> }","handlingStrategy":"validation","validationCode":"// validate index contents are JSON-serializable before persisting\nserde_json::to_value(&index).expect(\"index must serialize\");","typeGuard":"fn index_serializable<T: serde::Serialize>(idx: &T) -> bool {\n    serde_json::to_vec(idx).is_ok()\n}","tryCatchPattern":"match persist_result {\n    Err(TableIndexError::SerializeIndex(e)) => {\n        log::error(\"index serialization failed: {e}\");\n        // report bug / skip custom fields\n    }\n    other => other?,\n}","preventionTips":["Keep index fields as plain serde-supported types","Avoid custom Serialize impls on index structs","Mark auxiliary/debug fields #[serde(skip)]","Run round-trip tests (serialize then deserialize) on index types"],"tags":["serialization","serde","table-index","json"],"backgroundTag":"json-serialization-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"}