{"record":{"id":"f421872b0323f77d","repo":"slint-ui/slint","slug":"create-err","errorCode":null,"errorMessage":"create {}: {err}","messagePattern":"create (.+?): (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/node/build.rs","lineNumber":675,"sourceCode":"fn generated_dir() -> PathBuf {\n    PathBuf::from(env!(\"CARGO_MANIFEST_DIR\")).join(\"typescript\").join(\"generated\")\n}\n\n/// The banner every generated module starts with. These files are gitignored, so REUSE\n/// never sees them and they need no license header.\nfn generated_header(sources: &[&str]) -> String {\n    format!(\n        \"// AUTO-GENERATED by api/node/build.rs from {}. Do not edit.\\n\\n\",\n        sources.join(\"\\n// \")\n    )\n}\n\n/// Write `contents` only if it differs, so we don't invalidate downstream builds, and watch\n/// the result so it regenerates when edited or removed by hand.\nfn write_if_changed(path: &std::path::Path, contents: &str) {\n    println!(\"cargo:rerun-if-changed={}\", path.display());\n    let dir = path.parent().expect(\"generated file has a parent directory\");\n    std::fs::create_dir_all(dir).unwrap_or_else(|err| panic!(\"create {}: {err}\", dir.display()));\n    let needs_write =\n        std::fs::read_to_string(path).map(|existing| existing != contents).unwrap_or(true);\n    if needs_write {\n        std::fs::write(path, contents)\n            .unwrap_or_else(|err| panic!(\"write {}: {err}\", path.display()));\n    }\n}\n","sourceCodeStart":657,"sourceCodeEnd":683,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/api/node/build.rs#L657-L683","documentation":"The Node.js binding build script fails when it cannot create the parent directory for a generated file (a Rust/JS language module). `write_if_changed` creates the target directory with `create_dir_all` before writing generated code, and panics with this message if the filesystem refuses. This is a build-time hard failure: the codegen cannot proceed without a writable output tree.","triggerScenarios":"Running `cargo build` (or any build invoking api/node/build.rs) where `std::fs::create_dir_all` fails for the generated module's parent directory — e.g. OUT_DIR path is read-only, a file exists where a directory is expected, or disk is full.","commonSituations":"Read-only OUT_DIR after permission changes; a stale file named like the generated directory; running the build as a different user with restricted permissions; disk-full or quota-exceeded environments; paths exceeding filesystem limits.","solutions":["Check permissions on the build output directory (target/ and OUT_DIR) and make it writable by the build user","If a regular file occupies the path where the directory should be, remove it and rebuild","Free disk space / check quota if the filesystem reported ENOSPC","Clean with `cargo clean` and rebuild to eliminate stale conflicting artifacts"],"exampleFix":"// before: build fails with EACCES\n// terminal: sudo chown -R $(whoami) target && cargo build\n// after\n# ensure OUT_DIR parent is writable before building\nchmod -R u+w target/","handlingStrategy":"validation","validationCode":"const dir = path.dirname(outputFile);\nif (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });\nfs.accessSync(path.dirname(outputFile), fs.constants.W_OK);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep build output owned by the same non-root user that runs cargo","Check disk space before long builds","Avoid creating files that shadow expected generated directories"],"tags":["build-script","filesystem","codegen","nodejs"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"bb937076de3f7919766c1f25e2e969367cf77e9a","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}