influxdata/influxdb · error · PersisterError

serde_json error

Error message

serde_json error: {0}

What it means

PersisterError::SerdeJson wraps a serde_json::Error from serializing or deserializing JSON inside the Persister. With `#[from]`, any `?`-propagated serde_json failure — e.g. encoding table definitions or decoding persisted JSON manifests — becomes this variant.

Solutions

  1. Inspect the inner serde_json message for the exact offset/reason of the parse or serialize failure.
  2. Validate/repair the JSON object in the object store or delete it so it can be re-created.
  3. Check for version skew: JSON persisted by an older influxdb3 may not deserialize with current structs.
  4. Ensure values being serialized are JSON-compatible (no NaN/f64::INFINITY).
Defensive patterns

Strategy: validation

Validate before calling

serde_json::to_value(&payload).map_err(|e| e)?; // fails early with a clear reason

Type guard

fn is_serde_error(e: &PersisterError) -> bool {
    matches!(e, PersisterError::SerdeJson(_))
}

Try / catch

match persister.persist(...).await {
    Err(PersisterError::SerdeJson(e)) => eprintln!("json failure at {}: {e}", e.line()),
    Err(e) => return Err(e.into()),
    Ok(v) => v,
}

Prevention

When it happens

Trigger: Persister calls `serde_json::to_*`/`from_*` when writing or reading JSON payloads to/from the object store (e.g. database/table definitions, snapshot manifests) and serialization fails due to malformed input or unsupported types.

Common situations: A JSON manifest in object storage was corrupted or hand-edited; struct definitions changed between versions making old persisted JSON incompatible; NaN/unsupported values passed to serialization.

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


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/01930b76a7a03a47. Report an issue: GitHub.

Appendix: source

Thrown at influxdb3_write/src/persister.rs:53

use influxdb3_wal::SnapshotSequenceNumber;
use iox_time::TimeProvider;
use object_store::path::Path as ObjPath;
use object_store::{ObjectMeta, ObjectStore};
use object_store_utils::{AdaptiveGetExt, AdaptivePutExt};
use observability_deps::tracing::{debug, error, info, trace, warn};
use parking_lot::RwLock;
use parquet::arrow::ArrowWriter;
use parquet::basic::Compression;
use parquet::file::metadata::ParquetMetaData;
use parquet::file::properties::WriterProperties;
use tokio::sync::Semaphore;

#[derive(Debug, thiserror::Error)]
pub enum PersisterError {
    #[error("datafusion error: {0}")]
    DataFusion(#[from] DataFusionError),

    #[error("serde_json error: {0}")]
    SerdeJson(#[from] serde_json::Error),

    #[error("object_store error: {0}")]
    ObjectStore(#[from] object_store::Error),

    #[error("parquet error: {0}")]
    ParquetError(#[from] parquet::errors::ParquetError),

    #[error("tried to serialize a parquet file with no rows")]
    NoRows,

    #[error("parse int error: {0}")]
    ParseInt(#[from] std::num::ParseIntError),

    #[error("unexpected persister error: {0:?}")]
    Unexpected(#[from] anyhow::Error),

    #[error("table snapshot persistence task panicked: {0}")]

View on GitHub (pinned to 06200ef96b)