vosen/ZLUDA · error
Failed to read {}: {}
Error message
Failed to read {}: {} What it means
ptx build-script panic in check_lfs_file: opening the .bc file succeeded but reading the 2-byte magic header failed. Since only 2 bytes are requested, this indicates a zero-length file or an I/O error — most commonly an aborted LFS smudge leaving an empty or unreadable file for lib/zluda_ptx_impl*.bc.
Source
Thrown at ptx/build.rs:18
use std::fs::File;
use std::io::Read;
fn main() {
let bc_path = "lib/zluda_ptx_impl.bc";
let bc_constrained_path = "lib/zluda_ptx_impl_constrained.bc";
println!("cargo:rerun-if-changed={}", bc_path);
println!("cargo:rerun-if-changed={}", bc_constrained_path);
check_lfs_file(bc_path);
check_lfs_file(bc_constrained_path);
}
fn check_lfs_file(bc_path: &str) {
let mut magic = [0u8; 2];
File::open(bc_path)
.unwrap_or_else(|e| panic!("Failed to open {}: {}", bc_path, e))
.read_exact(&mut magic)
.unwrap_or_else(|e| panic!("Failed to read {}: {}", bc_path, e));
assert!(
&magic == b"BC",
"{} is a git lfs stub and not the actual file. Run `git lfs pull` to fetch it",
bc_path
);
}
View on GitHub (pinned to 9c8b43f242)
Solutions
- Check that the .bc file is not zero-length; re-pull with `git lfs pull` if it is
- Ensure the file is a regular file with read permissions
- Retry the build after fixing LFS hooks (`git lfs install`)
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at ptx/build.rs:18 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of vosen/ZLUDA@9c8b43f242 (2026-09-06).
Data as JSON: /api/errors/803041165f5ff06b.
Report an issue: GitHub.