{"record":{"id":"5a1f6db86321e559","repo":"databendlabs/databend","slug":"unimplemented-deserialize-datasourcemeta","errorCode":null,"errorMessage":"Unimplemented deserialize DataSourceMeta","messagePattern":"Unimplemented deserialize DataSourceMeta","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/query/storages/fuse/src/operations/read/data_source_with_meta.rs","lineNumber":67,"sourceCode":"impl<T> Debug for DataSourceWithMeta<T> {\n    fn fmt(&self, f: &mut Formatter) -> std::fmt::Result {\n        f.debug_struct(\"DataSourceWithMeta\")\n            .field(\"meta\", &self.meta)\n            .finish()\n    }\n}\n\nimpl<T> serde::Serialize for DataSourceWithMeta<T> {\n    fn serialize<S>(&self, _: S) -> std::result::Result<S::Ok, S::Error>\n    where S: Serializer {\n        unimplemented!(\"Unimplemented serialize DataSourceMeta\")\n    }\n}\n\nimpl<'de, T> serde::Deserialize<'de> for DataSourceWithMeta<T> {\n    fn deserialize<D>(_: D) -> std::result::Result<Self, D::Error>\n    where D: Deserializer<'de> {\n        unimplemented!(\"Unimplemented deserialize DataSourceMeta\")\n    }\n}\n","sourceCodeStart":49,"sourceCodeEnd":70,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/query/storages/fuse/src/operations/read/data_source_with_meta.rs#L49-L70","documentation":"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'.","triggerScenarios":"Any serde deserialization targeting `DataSourceWithMeta<T>` — e.g. deserializing a checkpoint, cache entry, or JSON payload that contains this type.","commonSituations":"A struct gained a DataSourceWithMeta field and now derives Deserialize; replaying serialized pipeline state; config/test fixtures that mistakenly embed the type.","solutions":["Remove DataSourceWithMeta from deserializable structs or mark the field `#[serde(skip)]` with a Default","Store and load the underlying meta (e.g. SegmentInfo/TableMeta) and rebuild the wrapper at runtime","Implement deserialize by constructing the wrapper from the deserialized inner T"],"exampleFix":"// before\nlet state: Checkpoint = serde_json::from_str(&s)?; // contains DataSourceWithMeta\n// after\n#[derive(Deserialize)]\nstruct Checkpoint {\n    #[serde(skip, default = \"DataSourceWithMeta::default\")]\n    source: DataSourceWithMeta<FuseSegmentReader>,\n}","handlingStrategy":"type-guard","validationCode":"// do not deserialize into types containing DataSourceWithMeta\nstruct State { #[serde(skip, default)] source: DataSourceWithMeta<T> }","typeGuard":"fn is_deserializable_state<'de, D: Deserialize<'de>>() -> bool { D::deserialize(serde::de::IgnoredAny).is_ok() }","tryCatchPattern":"match std::panic::catch_unwind(AssertUnwindSafe(|| serde_json::from_str::<State>(&s))) { Ok(Ok(v)) => v, _ => rebuild_state_from_meta() }","preventionTips":["Keep DataSourceWithMeta out of serialized payloads; persist only the underlying meta and rebuild the wrapper","Use #[serde(skip, default)] for runtime-only fields in checkpoint structs","Search codebase for unimplemented!() serde impls before embedding those types in IPC formats"],"tags":["rust","serde","deserialization","unimplemented"],"backgroundTag":"method-not-implemented","analyzedSha":"288d84d76e20a2f8f7173bda9691eb6ece301aa9","analyzedAt":"2026-09-11T11:29:36.208Z","contentChangedAt":"2026-09-11T11:29:36.208Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}