{"record":{"id":"ab84ef26c09faa2f","repo":"AlexsJones/llmfit","slug":"failed-to-write-generated-web-assets-rs","errorCode":null,"errorMessage":"failed to write generated web_assets.rs","messagePattern":"failed to write generated web_assets\\.rs","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"llmfit-tui/build.rs","lineNumber":30,"sourceCode":"    let out_dir = PathBuf::from(env::var(\"OUT_DIR\").expect(\"OUT_DIR\"));\n    let out_file = out_dir.join(\"web_assets.rs\");\n\n    let generated = if dist_dir.exists() {\n        let mut files = Vec::new();\n        collect_files(&dist_dir, &mut files);\n        files.sort();\n        for file in &files {\n            println!(\"cargo:rerun-if-changed={}\", file.display());\n        }\n        generate_assets_from_dist(&dist_dir, &files)\n    } else {\n        println!(\n            \"cargo:warning=llmfit-web/dist not found. Falling back to placeholder embedded dashboard. Run `npm ci && npm run build` in llmfit-web.\"\n        );\n        generate_fallback_assets()\n    };\n\n    fs::write(&out_file, generated).expect(\"failed to write generated web_assets.rs\");\n}\n\nfn collect_files(dir: &Path, files: &mut Vec<PathBuf>) {\n    let entries = fs::read_dir(dir).unwrap_or_else(|_| panic!(\"failed to read {}\", dir.display()));\n\n    for entry in entries {\n        let entry = entry.expect(\"invalid dir entry\");\n        let path = entry.path();\n        if path.is_dir() {\n            collect_files(&path, files);\n        } else {\n            files.push(path);\n        }\n    }\n}\n\nfn generate_assets_from_dist(dist_dir: &Path, files: &[PathBuf]) -> String {\n    let mut output = String::new();","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/AlexsJones/llmfit/blob/acc7e40c3a0afbd36510a92f2f8f3d5177cfc0fe/llmfit-tui/build.rs#L12-L48","documentation":"The final step of llmfit-tui/build.rs writes the generated web_assets.rs into OUT_DIR with fs::write(...).expect(\"failed to write generated web_assets.rs\"). The generation itself cannot fail; the write fails only at the filesystem level — OUT_DIR removed mid-build, a read-only or full disk, sandbox/permission denials, or path-length limits on Windows.","triggerScenarios":"A concurrent `cargo clean` deleting target/ while a build is in the write phase; a full disk or quota on the build volume; container/CI sandboxes mounting OUT_DIR read-only; antivirus locking the freshly created file on Windows.","commonSituations":"Disk-space exhaustion on CI runners with large embedded asset output; parallel cargo invocations racing over the same target dir; macOS/Windows security software interfering with generated files.","solutions":["Free space or raise the quota on the volume holding target/, then rebuild","Avoid concurrent cargo clean/build over the same target directory; use separate target dirs (CARGO_TARGET_DIR) for parallel jobs","Check permissions of target/debug/build/llmfit-*/out/ and remount/adjust the sandbox so OUT_DIR is writable"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"# shell pre-flight before cargo build\nout_dir=$(ls -d target/debug/build/llmfit-*/out 2>/dev/null | head -1)\nif [ -n \"$out_dir\" ] && ! touch \"$out_dir/.probe\" 2>/dev/null; then\n  echo \"OUT_DIR not writable — fix permissions/disk\" >&2; exit 1\nfi\ndf -h . | awk 'NR==2 && $5+0 > 95 { print \"disk nearly full\"; exit 1 }'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep free disk headroom on the build volume; embedded web assets make web_assets.rs large","Run concurrent builds with separate CARGO_TARGET_DIR values","Never cargo clean in parallel with an active build of the same target dir"],"tags":["rust","build-script","filesystem","io-error","panic"],"backgroundTag":"build-output-write-failed","analyzedSha":"acc7e40c3a0afbd36510a92f2f8f3d5177cfc0fe","analyzedAt":"2026-08-17T10:35:29.658Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}