BigPizzaV3/CodexPlusPlus · error

macOS bundle binary is unavailable at

Error message

macOS bundle binary is unavailable at {}: {error}

What it means

On macOS, validate_binary_source (macOS-only) checks via fs::metadata that the binary to be written into the bundle exists and is a regular file before copying it. If metadata cannot be read, the path with the OS error is reported; this particular message is the metadata-read failure arm.

Solutions

  1. Build the binary first (cargo build --release) and confirm the path exists
  2. Correct the configured binary source path to the actual build output
  3. Check file permissions on the path and its parent directories
  4. Verify the volume containing the binary is mounted

Example fix

// before
validate_binary_source(Path::new("target/debug/app")) // not built
// after
cargo build --release
validate_binary_source(Path::new("target/release/app"))
Defensive patterns

Strategy: validation

Validate before calling

use std::path::Path;
fn binary_ready(path: &Path) -> bool {
    path.is_file() // exists and is a regular file
}

Try / catch

if let Err(e) = write_bundle(&src, &dst) {
    if e.to_string().starts_with("macOS bundle binary is unavailable") {
        eprintln!("Rebuild the binary or fix the source path: {e}");
    }
}

Prevention

When it happens

Trigger: write_bundle is called with a source binary path that does not exist or is inaccessible (broken symlink, wrong build output path, path on an unmounted volume).

Common situations: Packaging script points at a stale target/release path; cargo build skipped or failed so the binary was never produced; network volume unmounted; permission issue on the build output.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19). Data as JSON: /api/errors/c37f7f8d9b10e3fa. Report an issue: GitHub.

Appendix: source

Thrown at crates/codex-plus-core/src/install/macos.rs:141

        let mut permissions = fs::metadata(&target)?.permissions();
        permissions.set_mode(0o755);
        fs::set_permissions(target, permissions)?;
    } else {
        anyhow::bail!("macOS bundle is missing its binary source");
    }
    let executable = macos.join(executable_name_from_plist(&bundle.info_plist));
    fs::write(&executable, &bundle.launch_script)?;
    let mut permissions = fs::metadata(&executable)?.permissions();
    permissions.set_mode(0o755);
    fs::set_permissions(executable, permissions)?;
    copy_icon(&resources)?;
    Ok(())
}

#[cfg(target_os = "macos")]
fn validate_binary_source(path: &Path) -> anyhow::Result<()> {
    let metadata = fs::metadata(path).map_err(|error| {
        anyhow::anyhow!(
            "macOS bundle binary is unavailable at {}: {error}",
            path.display()
        )
    })?;
    if !metadata.is_file() {
        anyhow::bail!(
            "macOS bundle binary is not a regular file: {}",
            path.display()
        );
    }
    if metadata.len() < 1024 {
        anyhow::bail!(
            "macOS bundle binary is unexpectedly small: {}",
            path.display()
        );
    }
    let mut header = [0_u8; 2];
    let mut file = fs::File::open(path)?;

View on GitHub (pinned to b1ed92e5e4)