vosen/ZLUDA · error

Failed to read {}: {}

Error message

Failed to read {}: {}

What it means

Build-script panic in check_lfs_file: the file opened successfully but reading the first bytes failed, typically because the path points to a directory, the file is empty, or an I/O error (permissions, disk, race with LFS smudge) occurred mid-read. The read is only 2 bytes to inspect the magic header, so failure almost always indicates the wrong kind of file rather than truncation.

Source

Thrown at llvm_zluda/build.rs:79

    println!("cargo:build-path={}", llvm_build_path.display());
    let (cxxflags, ldflags, libdir, lib_names, system_libs) =
        llvm_config(&llvm_build_path.join("bin/llvm-config")).unwrap();
    println!("cargo:rustc-link-arg={ldflags}");
    println!("cargo:rustc-link-search=native={libdir}");
    for lib in system_libs.split_ascii_whitespace() {
        println!("cargo:rustc-link-arg={lib}");
    }
    link_lld_components();
    link_llvm_components(lib_names);
    compile_cxx_lib(cxxflags, &llvm_build_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
    );
}

// https://github.com/mozilla/sccache/blob/main/README.md#usage
fn try_use_sccache(cmake: &mut Config) {
    if let Ok(sccache) = std::env::var("SCCACHE_PATH") {
        cmake.define("CMAKE_CXX_COMPILER_LAUNCHER", &*sccache);
        cmake.define("CMAKE_C_COMPILER_LAUNCHER", &*sccache);
        match std::env::var_os("CARGO_CFG_TARGET_OS") {
            Some(os) if os == "windows" => {
                cmake.define(
                    "CMAKE_MSVC_DEBUG_INFORMATION_FORMAT",
                    "$<$<CONFIG:Debug,RelWithDebInfo>:Embedded>",
                );

View on GitHub (pinned to 9c8b43f242)

Solutions

  1. Confirm the path is a regular file and not a directory
  2. Run `git lfs pull` to replace any stub with the real object
  3. Check file permissions and disk health if the error persists
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at llvm_zluda/build.rs:79 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/26f9adb6a4269ca2. Report an issue: GitHub.