BoundaryML/baml · error

{err}

Error message

{err}

What it means

`download_host_binary_from_release` wraps any failure from `fetcher.fetch_binary(host_name)` (a release-asset download for the host binary) into a plain `anyhow!` error that simply interpolates the underlying message. It means the pack command could not download the platform-specific host binary from the BAML release artifacts.

Source

Thrown at baml_language/crates/baml_cli/src/pack_command.rs:611

    if target_triple.ends_with("windows-msvc") {
        "baml-pack-host.exe".to_string()
    } else {
        "baml-pack-host".to_string()
    }
}

fn download_host_binary_from_release(target: &str, host_name: &str) -> Result<Vec<u8>> {
    let version = release_version_for_download();
    let fetcher = baml_release::Fetcher::default_for(
        baml_release::ReleaseSpec {
            version,
            target: target.to_string(),
        },
        baml_release::Product::Toolchain,
    );
    fetcher
        .fetch_binary(host_name)
        .map_err(|err| anyhow!("{err}"))
}

fn release_version_for_download() -> String {
    std::env::var("BAML_PACK_HOST_RELEASE_VERSION")
        .ok()
        .filter(|v| !v.trim().is_empty())
        .unwrap_or_else(|| release_version().to_string())
}

fn release_host_target_triple() -> Result<&'static str> {
    baml_release::release_host_target_triple()
}

fn validate_release_target_triple(target: &str) -> Result<&str> {
    baml_release::validate_release_target_triple(target)
        .map_err(|err| anyhow!("unsupported pack target `{target}`. {err}"))
}

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Check network connectivity / proxy settings so the release download can reach the release host.
  2. Verify the release version being downloaded exists and has an asset for your target; unset or correct `BAML_PACK_HOST_RELEASE_VERSION` if it pins a nonexistent release.
  3. Confirm the target triple passed to `baml pack` is one with published host binaries (`baml pack` with a supported triple).
  4. Place the correct host binary next to the `baml` executable manually so the download path is skipped entirely.

Example fix

// before: pinned to a version with no matching asset
export BAML_PACK_HOST_RELEASE_VERSION=0.0.0
// after: let the tool use the current release, or pin a real one
unset BAML_PACK_HOST_RELEASE_VERSION
# or
export BAML_PACK_HOST_RELEASE_VERSION=0.205.0
Defensive patterns

Strategy: retry

Validate before calling

// before packing, check the pinned release exists
let version = std::env::var("BAML_PACK_HOST_RELEASE_VERSION").ok();
if let Some(v) = version {
    let url = format!("https://github.com/{repo}/releases/tag/{v}");
    if reqwest::blocking::get(&url)?.status() != 200 {
        return Err(anyhow!("release {v} does not exist; unset BAML_PACK_HOST_RELEASE_VERSION or pick a published version"));
    }
}

Try / catch

match download_host_binary_from_release(&target, &reporter) {
    Ok(bytes) => install(bytes),
    Err(e) => {
        warn!("host binary download failed: {e}; retrying with backoff");
        with_backoff(3, || download_host_binary_from_release(&target, &reporter))?;
    }
}

Prevention

When it happens

Trigger: `read_host_binary` fails to find a local host binary next to the executable (non-native target or missing file), so it calls `download_host_binary_from_release`, whose `fetcher.fetch_binary(host_name)` returns an Err — network failure, missing release asset for that target/version, or auth/HTTP error — which is rewrapped verbatim with `anyhow!("{err}")`.

Common situations: Offline or proxied environment blocking GitHub releases; `BAML_PACK_HOST_RELEASE_VERSION` pinned to a version whose assets don't exist; a target triple with no published host binary; corporate proxy or firewall blocking the download.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/4409143ea40045ce. Report an issue: GitHub.