influxdata/influxdb · error · TableIndexCacheError
JSON serialization/deserialization failed
Error message
JSON serialization/deserialization failed
What it means
TableIndexCacheError::Json wraps a serde_json::Error raised while the TableIndexCache serializes or deserializes snapshot/index payloads as JSON. It means bytes read from (or data written to) the object store could not be converted to the expected Rust types, usually indicating corrupt, truncated, or schema-incompatible files.
Solutions
- Identify the failing file from the logs/operation context and validate its JSON (e.g. jq) to confirm corruption or truncation.
- Restore the corrupt file from a backup, or quarantine/remove it if it is a stale conversion artifact, then re-run initialize().
- Verify all nodes run the same, compatible InfluxDB 3 version so serialized schemas match.
- If it happens on a marker/metadata write, check for disk-full or quota conditions on the object store.
Example fix
// before
let marker: TableIndexConversionCompleted = serde_json::from_slice(&bytes).unwrap();
// after: surface a typed error instead of panicking
let marker: TableIndexConversionCompleted = serde_json::from_slice(&bytes)
.map_err(TableIndexCacheError::Json)?; Defensive patterns
Strategy: validation
Validate before calling
// sanity-check loaded JSON bytes before typed deserialization
if bytes.is_empty() || serde_json::from_slice::<serde_json::Value>(&bytes).is_err() {
return Err(TableIndexCacheError::Json(serde_json::from_slice::<serde_json::Value>(&bytes).unwrap_err()));
} Type guard
fn is_valid_index_json(bytes: &[u8]) -> bool {
serde_json::from_slice::<serde_json::Value>(bytes).is_ok()
} Try / catch
match deserialize_index(&bytes) {
Err(TableIndexCacheError::Json(e)) => {
warn!("corrupt index payload: {e}; reloading from source snapshots");
rebuild_from_snapshots().await?
}
r => r?,
} Prevention
- Validate JSON files with jq before restoring them into the snapshot directory
- Keep node versions homogeneous so serde schemas match
- Watch for disk-full/quota alerts on the object store
- Treat serde_json .unwrap() calls in conversion code as bugs to fix
When it happens
Trigger: serde_json round-trips performed inside TableIndexCache operations, e.g. deserializing persisted snapshot/index bytes loaded during get_or_load, update_from_object_store, or startup conversion, or serializing conversion markers and index payloads.
Common situations: Snapshot files truncated by a prior crash, files written by an incompatible older InfluxDB 3 schema, or human edits to files in the object store snapshot directory.
Understand the failure class
Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.
Related errors
- JSON serialization/deserialization failed
- serde_json error
- error decoding query body
- Failed to deserialize table index
- failed to serialize the request body
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/53be60186e2d2fd9.
Report an issue: GitHub.
Appendix: source
Thrown at influxdb3_write/src/table_index_cache.rs:45
use influxdb3_wal::SnapshotSequenceNumber;
use crate::{
ParquetFile,
paths::{
SnapshotInfoFilePath, TableIndexConversionCompletedPath, TableIndexPath,
TableIndexSnapshotPath,
},
table_index::{CoreTableIndex, IndexMetadata, TableIndex, TableIndexSnapshot},
};
use thiserror::Error;
#[derive(Debug, Error)]
pub enum TableIndexCacheError {
#[error("Object store operation failed")]
ObjectStore(#[source] object_store::Error),
#[error("JSON serialization/deserialization failed")]
Json(#[source] serde_json::Error),
#[error("TableIndex operation failed")]
TableIndex(#[source] crate::table_index::TableIndexError),
#[error("Object meta is missing filename")]
MissingFilename,
#[error("Failed to parse snapshot sequence number from filename")]
InvalidSnapshotSequenceNumber,
#[error("Unexpected error")]
Unexpected(#[source] anyhow::Error),
#[error("Table snapshot persistence task failed")]
TableSnapshotPersistenceTaskFailed(#[source] tokio::task::JoinError),
#[error("Failed to list table indices from object store")]View on GitHub (pinned to 06200ef96b)