BigPizzaV3/CodexPlusPlus · error · anyhow::Error

macOS bundle binary is unexpectedly small

Error message

macOS bundle binary is unexpectedly small: {}

What it means

validate_binary_source rejects the bundle binary when its size is under 1024 bytes. A real Rust executable is always far larger, so a tiny file indicates truncation, a stub, a placeholder, or a failed download that must not be copied into the .app bundle.

Solutions

  1. Re-download or rebuild the binary and verify its size matches the expected artifact
  2. Check `ls -l` / checksums against the release artifact to confirm integrity
  3. If using Git LFS, run `git lfs pull` so the real binary replaces the pointer file
  4. Free disk space and redo the packaging step if the artifact was truncated
Defensive patterns

Strategy: validation

Validate before calling

let meta = std::fs::metadata(&path)?;
if meta.len() < 1024 {
    return Err(format!("binary too small ({} bytes): {}", meta.len(), path.display()));
}

Prevention

When it happens

Trigger: write_bundle -> validate_binary_source on macOS when metadata.len() < 1024 for the source binary.

Common situations: Interrupted download or truncated artifact from CI; a placeholder text file committed where the binary belongs; LFS pointer files not materialized; disk-full writes producing partial binaries.

Understand the failure class

Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.

Related errors


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

Appendix: source

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

    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)?;
    use std::io::Read;
    let read = file.read(&mut header)?;
    if read == header.len() && header == *b"#!" {
        anyhow::bail!(
            "macOS bundle binary points to a shell script: {}",
            path.display()
        );
    }
    Ok(())
}

#[cfg(target_os = "macos")]

View on GitHub (pinned to b1ed92e5e4)