{"record":{"id":"821f3799969dffad","repo":"pola-rs/polars","slug":"failed-to-write-the-schema-into-the-file","errorCode":null,"errorMessage":"failed to write the schema into the file","messagePattern":"failed to write the schema into the file","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/polars-plan/src/bin/dsl-schema.rs","lineNumber":88,"sourceCode":"\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`\");\n\n            eprintln!(\"expected schema hashes:\");\n            eprintln!(\"{}\", expected);\n\n            std::process::exit(1);\n        }\n        eprintln!(\"the DSL schema hashes are up to date\");\n    }","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/pola-rs/polars/blob/fe841f959ef4d2ceefc05a310d33ed7b1ab24e5e/crates/polars-plan/src/bin/dsl-schema.rs#L70-L106","documentation":"`update_hashes` writes the current schema hashes via `std::fs::write(path, ...)` and expects success. Any I/O failure creating/truncating/writing the hashes file panics with this message and the underlying io::Error attached.","triggerScenarios":"`dsl-schema update-hashes <path>` where the path is in a non-existent directory, is a directory itself, or is not writable (permissions, read-only filesystem).","commonSituations":"DEFAULT_HASHES_PATH pointing at a read-only checkout, CI running without write access to the repo, or a misconfigured Makefile path for update-dsl-schema-hashes.","solutions":["Ensure the target path's parent directory exists and is writable.","Check that the path isn't a directory and you have write permission.","Run from a writable checkout (not a read-only mount) when using the default hashes path."],"exampleFix":"// before\ndsl-schema update-hashes /read-only/fs/hashes.json\n\n// after\ndsl-schema update-hashes ./crates/polars-plan/src/dsl-schema-hashes.json","handlingStrategy":"validation","validationCode":"import os, stat\npath = \"./hashes.json\"\nif os.path.isdir(path): raise IsADirectoryError(path)\ndir = os.path.dirname(path) or \".\"\nos.makedirs(dir, exist_ok=True)\nif not os.access(dir, os.W_OK): raise PermissionError(dir)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run update-hashes in a writable checkout, never a read-only mount.","Verify DEFAULT_HASHES_PATH resolves from your working directory.","Ensure CI jobs have write permission to the repo files they update."],"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"}