{"record":{"id":"403a74483cfdc77a","repo":"pola-rs/polars","slug":"failed-to-flush-the-schema-file","errorCode":null,"errorMessage":"failed to flush the schema file","messagePattern":"failed to flush the schema file","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-plan/src/bin/dsl-schema.rs","lineNumber":80,"sourceCode":"            \"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 {\n            eprintln!(\"the schema hashes are not up to date, run `make update-dsl-schema-hashes`\");","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-plan/src/bin/dsl-schema.rs#L62-L98","documentation":"`generate` finishes with `file.flush()` and expects success. A panic here means buffered data could not be pushed to the underlying file — an I/O error such as disk-full, device error, or a closed/invalid handle.","triggerScenarios":"flush() returning Err because the OS write failed (ENOSPC, EIO) after the JSON and newline writes were buffered.","commonSituations":"Running out of disk space at the very end of generation; failing storage devices; container filesystem limits hit during CI schema regeneration.","solutions":["Check and free disk space, then regenerate the schema file.","Inspect the panic's io::Error message for the OS-level cause (ENOSPC, EIO, etc.).","Re-run `dsl-schema generate` after fixing storage; delete a partially-written output file first."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"free_kb=$(df -k --output=avail . | tail -1)\n[ \"$free_kb\" -gt 10240 ] || { echo \"disk nearly full\" >&2; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Read the io::Error in the panic message for the OS cause (ENOSPC/EIO).","Free disk space and remove partial outputs before retrying.","Check storage health if EIO recurs."],"tags":["io","file-write","flush","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"}