{"record":{"id":"2c8ba0704cc989a1","repo":"pola-rs/polars","slug":"failed-to-serialize-the-schema","errorCode":null,"errorMessage":"failed to serialize the schema","messagePattern":"failed to serialize the schema","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-plan/src/bin/dsl-schema.rs","lineNumber":78,"sourceCode":"                update_hashes(path.unwrap_or(DEFAULT_HASHES_PATH.to_owned()));\n            },\n            \"check-hashes\" => {\n                check_hashes(path.unwrap_or(DEFAULT_HASHES_PATH.to_owned()));\n            },\n            unknown => {\n                panic!(\"unknown command: `{unknown}`\");\n            },\n        }\n    }\n\n    /// Serializes the current DSL schema into a file at the given path.\n    ///\n    /// Any existing file at the path is overwritten.\n    fn generate(path: impl AsRef<Path>) {\n        let schema = DslPlan::dsl_schema();\n\n        let mut file = File::create(path).expect(\"failed to open the schema file for writing\");\n        serde_json::to_writer_pretty(&mut file, &schema).expect(\"failed to serialize the schema\");\n        writeln!(&mut file).expect(\"failed to write the last newline\");\n        file.flush().expect(\"failed to flush the schema file\");\n    }\n\n    /// Outputs the current DSL schema hashes into a file at the given path.\n    ///\n    /// Any existing file at the path is overwritten.\n    fn update_hashes(path: impl AsRef<Path>) {\n        std::fs::write(path, current_schema_hashes())\n            .expect(\"failed to write the schema into the file\");\n        eprintln!(\"the DSL schema file was updated\");\n    }\n\n    /// Checks that the current schema hashes match the schema hashes in the file.\n    fn check_hashes(path: impl AsRef<Path>) {\n        let file_hashes =\n            std::fs::read_to_string(path).expect(\"failed to read the schema hashes from the file\");\n        let expected = current_schema_hashes();","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-plan/src/bin/dsl-schema.rs#L60-L96","documentation":"After creating the file, `generate` serializes the DSL schema with `serde_json::to_writer_pretty` and expects success. A panic here means serde_json failed mid-write — typically an underlying I/O error while writing to the file, since the schema itself is serializable by construction.","triggerScenarios":"The output file/handle becomes unwritable during serialization (disk full, file closed/removed, I/O error on the underlying writer).","commonSituations":"Disk quota/full disk during schema generation in CI, network filesystem hiccups, or a schema type with a serde impl that fails on non-serializable data (e.g. NaN or map keys it can't serialize).","solutions":["Check free disk space and quota on the target filesystem.","Re-run the command; transient I/O failures often clear on retry.","If caused by schema data, update polars — serialization failures usually indicate a bug in a new node type's Schema implementation; file an issue."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"df -h . || true  # ensure adequate free space before generating\ndu -sh ./dsl-schema.json 2>/dev/null || true","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Monitor disk space in CI before schema regeneration jobs.","Prefer local disks over network mounts for generated artifacts.","Delete stale partial output files before re-running."],"tags":["serialization","json","panic"],"backgroundTag":"json-serialization-failed","analyzedSha":"fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e","analyzedAt":"2026-09-18T22:14:11.667Z","contentChangedAt":"2026-09-18T22:14:11.667Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}