AlexsJones/llmfit · warning
invalid dir entry
Error message
invalid dir entry
What it means
Inside collect_files(), which recursively walks llmfit-web/dist to enumerate dashboard assets, each DirEntry from fs::read_dir is unwrapped with .expect("invalid dir entry"). Iteration errors occur when an entry cannot be read — the file was deleted or renamed between the directory listing and the entry read (a race with `npm run build` rewriting dist/), or a subdirectory became unreadable due to permissions.
Source
Thrown at llmfit-tui/build.rs:37
for file in &files {
println!("cargo:rerun-if-changed={}", file.display());
}
generate_assets_from_dist(&dist_dir, &files)
} else {
println!(
"cargo:warning=llmfit-web/dist not found. Falling back to placeholder embedded dashboard. Run `npm ci && npm run build` in llmfit-web."
);
generate_fallback_assets()
};
fs::write(&out_file, generated).expect("failed to write generated web_assets.rs");
}
fn collect_files(dir: &Path, files: &mut Vec<PathBuf>) {
let entries = fs::read_dir(dir).unwrap_or_else(|_| panic!("failed to read {}", dir.display()));
for entry in entries {
let entry = entry.expect("invalid dir entry");
let path = entry.path();
if path.is_dir() {
collect_files(&path, files);
} else {
files.push(path);
}
}
}
fn generate_assets_from_dist(dist_dir: &Path, files: &[PathBuf]) -> String {
let mut output = String::new();
output.push_str("#[derive(Clone, Copy)]\n");
output.push_str("pub(crate) struct EmbeddedAsset {\n");
output.push_str(" pub(crate) path: &'static str,\n");
output.push_str(" pub(crate) content_type: &'static str,\n");
output.push_str(" pub(crate) bytes: &'static [u8],\n");
output.push_str("}\n\n");
output.push_str("pub(crate) static EMBEDDED_WEB_ASSETS: &[EmbeddedAsset] = &[\n");View on GitHub (pinned to acc7e40c3a)
Solutions
- Re-run `cargo build -p llmfit` after the npm build finishes — the rerun-if-changed directives will pick up the new dist and the walk will succeed
- Sequence your tooling so dist/ is fully built before the cargo step (make the cargo step depend on the npm build step)
- If it recurs, check permissions on llmfit-web/dist subdirectories (`find llmfit-web/dist -type d ! -readable`)
Defensive patterns
Strategy: retry
Validate before calling
# shell pre-flight: snapshot dist so the cargo walk sees a stable tree npm --prefix llmfit-web ci && npm --prefix llmfit-web run build tar -C llmfit-web -cf /tmp/llmfit-dist.tar dist # stable copy for rebuilds
Prevention
- Finish `npm run build` in llmfit-web before starting `cargo build -p llmfit`
- Avoid npm watch/cargo watch pointing at the same dist simultaneously
- If dist is on NFS/FUSE, copy it locally before building the Rust crate
When it happens
Trigger: Running `cargo build` in llmfit-tui while `npm run build` in llmfit-web is concurrently rewriting dist/ (files vanish mid-walk); a permissions change on a dist subdirectory during the walk; network filesystem flakiness where dist lives on a mount.
Common situations: Dev loops that rebuild the web dashboard and the Rust crate in parallel (npm watch + cargo watch); CI jobs sharing a workspace where one step regenerates dist while another compiles; NFS/FUSE-mounted checkouts.
Related errors
- failed to write generated web_assets.rs
- CARGO_MANIFEST_DIR
- OUT_DIR
- valid MLX suffix regex
- embedded benchmarks.yaml is invalid
AI-assisted analysis of AlexsJones/llmfit@acc7e40c3a (2026-08-17).
Data as JSON: /api/errors/a42c698caaa8d6ba.
Report an issue: GitHub.