BoundaryML/baml · error
pack CLI not found at {}
Error message
pack CLI not found at {} What it means
run_baml_pack expects the freshly built CLI binary at target/release/<exe_filename(cli_bin)> inside the workspace. If that file does not exist, it bails with the resolved path. This means the pack step's build didn't produce the expected binary where the config expects it.
Source
Thrown at baml_language/crates/tools_size_gate/src/measure.rs:122
if !status.success() {
bail!(
"cargo build failed for pack ({} + {})",
pack.cli_package,
pack.host_package
);
}
run_baml_pack(workspace_root, name, pack)
}
/// Run the freshly built CLI's `baml pack` on the fixture, writing the
/// output to a deterministic path under `target/size-gate/`.
fn run_baml_pack(workspace_root: &Path, name: &str, pack: &PackConfig) -> Result<PathBuf> {
let cli_path = workspace_root
.join("target/release")
.join(exe_filename(&pack.cli_bin));
if !cli_path.exists() {
bail!("pack CLI not found at {}", cli_path.display());
}
let fixture = workspace_root.join(&pack.fixture);
if !fixture.exists() {
bail!("pack fixture not found at {}", fixture.display());
}
let output = pack_output_path(workspace_root, name);
if let Some(parent) = output.parent() {
std::fs::create_dir_all(parent)
.with_context(|| format!("failed to create {}", parent.display()))?;
}
eprintln!(" packing {} -> {}", pack.function, output.display());
let status = Command::new(&cli_path)
.arg("pack")
.arg("--file")
.arg(&fixture)View on GitHub (pinned to bd85ce9dee)
Solutions
- Verify target/release/<cli_bin> exists after the build step in the workspace root
- Unset CARGO_TARGET_DIR or align pack_output_path with the custom target dir
- Check the cli_bin name in the pack config matches the actual bin in Cargo.toml
- If cross-compiling, ensure the config expects target/<triple>/release and adjust
Example fix
// before: CARGO_TARGET_DIR misplaces the binary CARGO_TARGET_DIR=./out size-gate measure ... // after unset CARGO_TARGET_DIR && size-gate measure ...
Defensive patterns
Strategy: validation
Validate before calling
let cli = workspace.join("target/release").join(exe_filename(cli_bin));
if !cli.exists() { eprintln!("expected release binary missing: {}", cli.display()); std::process::exit(1); } Prevention
- Do not set CARGO_TARGET_DIR when running size-gate
- Avoid cross-compiling for measurement, or adjust paths for target/<triple>/release
- After renaming bins, update the pack config in the same commit
- Add a post-build assertion that the binary path exists
When it happens
Trigger: Building the pack binaries did not emit target/release/<cli_bin> — wrong cli_bin name in the pack config, build ran in debug mode or another --target dir, or the release binary is on a triple-suffixed path when cross-compiling.
Common situations: CARGO_TARGET_DIR set to a non-default location; cross-compiling so the binary lands in target/<triple>/release; cli_bin renamed; build silently skipped (e.g. cargo build error handled earlier).
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
- pack fixture not found at {}
- toolchain binary not found: {}{origin}
- BAML toolchain {version} is not installed
- no `.baml` files found in {}
- File not found: {}
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/43b72109c8c2cbae.
Report an issue: GitHub.