{"record":{"id":"d8dd1a913e885c42","repo":"pola-rs/polars","slug":"failed-to-write-the-last-newline","errorCode":null,"errorMessage":"failed to write the last newline","messagePattern":"failed to write the last newline","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-plan/src/bin/dsl-schema.rs","lineNumber":79,"sourceCode":"            },\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();\n        if file_hashes != expected {","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-plan/src/bin/dsl-schema.rs#L61-L97","documentation":"After writing the JSON body, `generate` writes a trailing newline with `writeln!` and expects success. This panics if the write to the file fails, most commonly due to an I/O error on the output file handle.","triggerScenarios":"Disk becoming full between the JSON write and the newline write, or the file descriptor entering an error state (e.g. removed file, I/O error on the underlying device).","commonSituations":"Nearly-full disks in CI containers; flaky network-mounted volumes where a prior large write consumed the last available space.","solutions":["Free disk space and re-run `generate`.","Verify the output file was not truncated; regenerate it after fixing storage.","Retry on a different, local filesystem if using network storage."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"free_mb=$(df -m --output=avail . | tail -1)\n[ \"$free_mb\" -gt 100 ] || { echo \"insufficient disk space\" >&2; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure ample free space (output is pretty-printed JSON).","Retry generation after transient I/O failures.","Validate the produced file parses as JSON afterwards."],"tags":["io","file-write","panic"],"backgroundTag":"file-write-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"}