{"record":{"id":"f82576741304494a","repo":"pola-rs/polars","slug":"failed-to-serialize-schema-hashes-file","errorCode":null,"errorMessage":"failed to serialize schema hashes file","messagePattern":"failed to serialize schema hashes file","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-plan/src/bin/dsl-schema.rs","lineNumber":131,"sourceCode":"        let mut hashes = serde_json::Map::new();\n\n        // Insert the subschemas\n        if let Some(definitions) = schema.get(\"$defs\") {\n            if let Some(definitions) = definitions.as_object() {\n                for (name, def) in definitions {\n                    let mut def = def.to_owned();\n                    def.sort_all_objects();\n                    let schema: &Schema = (&def).try_into().unwrap();\n                    hashes.insert(name.into(), schema_hash(schema).into());\n                }\n\n                assert!(definitions.contains_key(\"DslPlan\"));\n            }\n        }\n\n        hashes.sort_keys();\n\n        serde_json::to_string_pretty(&hashes).expect(\"failed to serialize schema hashes file\")\n    }\n\n    fn schema_hash(schema: &Schema) -> String {\n        let mut digest = digest_io::IoWrapper(sha2::Sha256::new());\n        serde_json::to_writer(&mut digest, schema).expect(\"failed to serialize the schema\");\n        let hash = digest.0.finalize();\n        hex::encode(hash)\n    }\n}\n","sourceCodeStart":113,"sourceCodeEnd":141,"githubUrl":"https://github.com/pola-rs/polars/blob/9b5d73fd00236295624374b075d16b1fe6ec6df9/crates/polars-plan/src/bin/dsl-schema.rs#L113-L141","documentation":"Panics when serde_json cannot serialize the sorted schema-hash map to a pretty JSON string in current_schema_hashes(). Because the map contains only string keys and JSON values, failure is effectively impossible; this is a defensive guard on the serialization step.","triggerScenarios":"This panic/expect fires when execution reaches an unguarded state described by: \"failed to serialize schema hashes file\". Typical triggers: unsupported dtype or feature-gated code path reached at runtime, invalid user input or environment variable value, calling API methods in the wrong order or on mismatched types, or data (lengths, offsets, ranges) violating the function's preconditions.","commonSituations":"Encountered when input data or configuration does not meet the preconditions of the throwing code path (\"failed to serialize schema hashes file\"). Common cases: missing Cargo feature flags, mismatched dtypes/lengths between arrays or series, out-of-range temporal values, malformed environment variables, or operations on unsupported/complex nested types.","solutions":["Serialization of the schema hashes failed; check for invalid/non-UTF8 content in the schema.","Regenerate the hashes file from a clean checkout."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"9b5d73fd00236295624374b075d16b1fe6ec6df9","analyzedAt":"2026-08-19T12:15:06.350Z","contentChangedAt":"2026-08-19T12:15:06.350Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}