databendlabs/databend · error

Unimplemented deserialize DataSourceMeta

Error message

Unimplemented deserialize DataSourceMeta

What it means

The mirror stub of the serialize case: `DataSourceWithMeta<T>`'s `serde::Deserialize` impl is an `unimplemented!()`, since these runtime read-source wrappers are never expected to be reconstructed from bytes. Deserializing into this type panics with 'Unimplemented deserialize DataSourceMeta'.

Solutions

  1. Remove DataSourceWithMeta from deserializable structs or mark the field `#[serde(skip)]` with a Default
  2. Store and load the underlying meta (e.g. SegmentInfo/TableMeta) and rebuild the wrapper at runtime
  3. Implement deserialize by constructing the wrapper from the deserialized inner T

Example fix

// before
let state: Checkpoint = serde_json::from_str(&s)?; // contains DataSourceWithMeta
// after
#[derive(Deserialize)]
struct Checkpoint {
    #[serde(skip, default = "DataSourceWithMeta::default")]
    source: DataSourceWithMeta<FuseSegmentReader>,
}
Defensive patterns

Strategy: type-guard

Validate before calling

// do not deserialize into types containing DataSourceWithMeta
struct State { #[serde(skip, default)] source: DataSourceWithMeta<T> }

Type guard

fn is_deserializable_state<'de, D: Deserialize<'de>>() -> bool { D::deserialize(serde::de::IgnoredAny).is_ok() }

Try / catch

match std::panic::catch_unwind(AssertUnwindSafe(|| serde_json::from_str::<State>(&s))) { Ok(Ok(v)) => v, _ => rebuild_state_from_meta() }

Prevention

When it happens

Trigger: Any serde deserialization targeting `DataSourceWithMeta<T>` — e.g. deserializing a checkpoint, cache entry, or JSON payload that contains this type.

Common situations: A struct gained a DataSourceWithMeta field and now derives Deserialize; replaying serialized pipeline state; config/test fixtures that mistakenly embed the type.

Related errors


AI-assisted analysis of databendlabs/databend@288d84d76e (2026-09-11). Data as JSON: /api/errors/5a1f6db86321e559. Report an issue: GitHub.

Appendix: source

Thrown at src/query/storages/fuse/src/operations/read/data_source_with_meta.rs:67

impl<T> Debug for DataSourceWithMeta<T> {
    fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {
        f.debug_struct("DataSourceWithMeta")
            .field("meta", &self.meta)
            .finish()
    }
}

impl<T> serde::Serialize for DataSourceWithMeta<T> {
    fn serialize<S>(&self, _: S) -> std::result::Result<S::Ok, S::Error>
    where S: Serializer {
        unimplemented!("Unimplemented serialize DataSourceMeta")
    }
}

impl<'de, T> serde::Deserialize<'de> for DataSourceWithMeta<T> {
    fn deserialize<D>(_: D) -> std::result::Result<Self, D::Error>
    where D: Deserializer<'de> {
        unimplemented!("Unimplemented deserialize DataSourceMeta")
    }
}

View on GitHub (pinned to 288d84d76e)