{"record":{"id":"da807f03ccea4ece","repo":"dbt-labs/dbt-core","slug":"failed-to-deserialize","errorCode":null,"errorMessage":"Failed to deserialize","messagePattern":"Failed to deserialize","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/dbt-adapter/src/time_machine/metadata.rs","lineNumber":838,"sourceCode":"                DataType::FixedSizeList(\n                    Arc::new(Field::new(\n                        \"item\",\n                        DataType::Timestamp(TimeUnit::Microsecond, None),\n                        true,\n                    )),\n                    1,\n                ),\n                true,\n            ),\n        ]));\n        map.insert(\"test.schema.complex\".to_string(), Ok(schema));\n\n        // Serialize to JSON\n        let json = map.to_recording_json();\n\n        // Deserialize back\n        let deserialized: HashMap<String, AdapterResult<Arc<Schema>>> =\n            HashMap::from_recording_json(&json).expect(\"Failed to deserialize\");\n\n        // Verify roundtrip\n        assert_eq!(map.len(), deserialized.len());\n        let original_schema = map.get(\"test.schema.complex\").unwrap().as_ref().unwrap();\n        let result_schema = deserialized\n            .get(\"test.schema.complex\")\n            .unwrap()\n            .as_ref()\n            .unwrap();\n\n        // Compare field by field\n        assert_eq!(original_schema.fields().len(), result_schema.fields().len());\n        for (orig, res) in original_schema.fields().iter().zip(result_schema.fields()) {\n            assert_eq!(orig.name(), res.name(), \"Field name mismatch\");\n            assert_eq!(\n                orig.data_type(),\n                res.data_type(),\n                \"DataType mismatch for field {}\",","sourceCodeStart":820,"sourceCodeEnd":856,"githubUrl":"https://github.com/dbt-labs/dbt-core/blob/0267ce9170576975b76b64ce856b2e5848e96617/crates/dbt-adapter/src/time_machine/metadata.rs#L820-L856","documentation":"This is a test assertion panic from `expect(\"Failed to deserialize\")` on `HashMap::from_recording_json(&json)`. The time-machine recording layer serializes a map of `AdapterResult<Arc<Schema>>` to JSON and must reconstruct it on replay; if the recorded JSON does not round-trip into the same map (bad/missing type tags, unrepresentable complex types, schema field loss), the deserializer returns an error and this expect panics the test. It indicates a gap in the recording JSON codec for the schema payloads in `crates/dbt-adapter/src/time_machine/metadata.rs:838`.","triggerScenarios":"Calling `HashMap::from_recording_json` on output of `to_recording_json` where the JSON contains schema types the deserializer cannot reconstruct (e.g. complex/nested types in test_schema_roundtrip_with_complex_types), or where the `__type__` markers/AdapterResult wrappers were dropped during serialization.","commonSituations":"Adding a new Arrow/Schema field type without extending the recording serializer; a schema type whose serde representation changed between versions so older recordings no longer parse; running replay tests against recordings produced by a different build.","solutions":["Run the failing test with RUST_BACKTRACE=1 to see the underlying serde/deserialization error returned by from_recording_json.","Inspect the JSON produced by `to_recording_json` for the failing key (test.schema.complex) and compare against what from_recording_json expects (type tags, AdapterResult wrappers).","Extend the recording JSON (de)serializer in metadata.rs to support the complex type that fails, so serialize and deserialize are symmetric.","Regenerate any stale recordings with the current code version before running replay tests.","If the schema itself is unsupported, either normalize it before recording or mark the test case as unsupported for recording."],"exampleFix":"// before\nlet deserialized: HashMap<String, AdapterResult<Arc<Schema>>> =\n    HashMap::from_recording_json(&json).expect(\"Failed to deserialize\");\n// after (debug first, then fix codec)\nlet deserialized = HashMap::from_recording_json(&json)\n    .unwrap_or_else(|e| panic!(\"Failed to deserialize: {e}; json={json}\"));","handlingStrategy":"validation","validationCode":"if let Err(e) = HashMap::<String, AdapterResult<Arc<Schema>>>::from_recording_json(&json) {\n    eprintln!(\"recording not deserializable: {e}\");\n    // regenerate or reject the recording before use\n}","typeGuard":"fn is_deserializable_recording(json: &serde_json::Value) -> bool {\n    json.get(\"__type__\").is_some()\n}","tryCatchPattern":"match HashMap::from_recording_json(&json) {\n    Ok(map) => map,\n    Err(e) => { log::error(\"schema recording deserialize failed: {e}\"); regenerate_recording() }\n}","preventionTips":["Add roundtrip property tests for every recordable schema type.","Regenerate recordings whenever the Schema codec changes.","Never swallow from_recording_json errors; log the payload on failure."],"tags":["rust","serialization","roundtrip","time-machine"],"backgroundTag":"json-unmarshal-failed","analyzedSha":"0267ce9170576975b76b64ce856b2e5848e96617","analyzedAt":"2026-09-07T21:53:39.732Z","contentChangedAt":"2026-09-07T21:53:39.732Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}