influxdata/influxdb · error · TableIndexError
Failed to deserialize table index
Error message
Failed to deserialize table index
What it means
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.
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)]
Example fix
// before
struct CustomIndex { meta: std::collections::HashMap<NonZeroU32, String> } // non-string keys can fail
// after
#[derive(serde::Serialize)]
struct CustomIndex { meta: std::collections::HashMap<String, String> } Defensive patterns
Strategy: validation
Validate before calling
// validate index contents are JSON-serializable before persisting
serde_json::to_value(&index).expect("index must serialize"); Type guard
fn index_serializable<T: serde::Serialize>(idx: &T) -> bool {
serde_json::to_vec(idx).is_ok()
} Try / catch
match persist_result {
Err(TableIndexError::SerializeIndex(e)) => {
log::error("index serialization failed: {e}");
// report bug / skip custom fields
}
other => other?,
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: "JSON serialization failed", "not JSON serializable", "Failed to serialize": why JSON marshaling errors happen and how to fix them — this error's family across 46 libraries.
Related errors
- failed to serialize the request body
- JSON serialization/deserialization failed
- JSON serialization/deserialization failed
- serde_json error
- deserializing show tables
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/118835aa1664bf20.
Report an issue: GitHub.
Appendix: source
Thrown at influxdb3_write/src/table_index.rs:25
use observability_deps::tracing::{debug, warn};
use serde::{Deserialize, Serialize};
use thiserror::Error;
use tokio::sync::Semaphore;
use influxdb3_id::{DbId, ParquetFileId, TableId, TableIndexId};
use influxdb3_wal::SnapshotSequenceNumber;
use crate::{
ParquetFile, PersistedSnapshot, PersistedSnapshotVersion,
paths::{SnapshotInfoFilePath, TableIndexPath, TableIndexSnapshotPath},
};
#[derive(Debug, Error)]
pub enum TableIndexError {
#[error("Failed to load table index from object store")]
LoadIndex(#[source] object_store::Error),
#[error("Failed to deserialize table index")]
SerializeIndex(#[source] serde_json::Error),
#[error("Failed to deserialize table index")]
DeserializeIndex(#[source] serde_json::Error),
#[error("Failed to list table index snapshots from object store")]
ListSnapshots(#[source] object_store::Error),
#[error("Failed to list table indices from object store")]
ListIndices(#[source] object_store::Error),
#[error("Failed to load table index snapshot from object store")]
LoadSnapshot(#[source] object_store::Error),
#[error("Failed to deserialize table index snapshot")]
DeserializeSnapshot(#[source] serde_json::Error),
#[error("Failed to persist table index to object store")]View on GitHub (pinned to 06200ef96b)