BoundaryML/baml · error

{err}

Error message

{err}

What it means

install_toolchain downloads a toolchain artifact and installs it into the toolchains directory; if the fetcher's install_to_toolchain_root call fails, the underlying fetcher error is re-wrapped as-is via anyhow!. This is a generic propagation point — the real cause lives in the fetcher error message (download, network, or archive issues).

Source

Thrown at baml_language/crates/baml/src/main.rs:1244

    fs::create_dir_all(toolchains_dir())?;
    if force {
        let dir = toolchains_dir().join(version);
        if dir.exists() {
            fs::remove_dir_all(dir)?;
        }
    }
    let fetcher = baml_release::Fetcher::from_artifact(
        ReleaseSpec {
            version: version.to_string(),
            target: target.to_string(),
        },
        Product::Toolchain,
        artifact,
    );
    fetcher
        .install_to_toolchain_root(&toolchains_dir())
        .map(|_| ())
        .map_err(|err| anyhow!("{err}"))
}

fn prepare_toolchain_selector(
    selector: &str,
    base: &Path,
    override_url: Option<&str>,
) -> Result<String> {
    let selector = normalize_selector(selector, base);
    if is_path_selector(&selector) {
        verify_path_toolchain(Path::new(&selector), "")?;
        return Ok(selector);
    }
    if is_channel(&selector) {
        install_toolchain(&selector, true, override_url, false)?;
    } else {
        let target = baml_release::release_host_target_triple()?;
        if !toolchain_cli_path(&selector).exists() {
            let manifest = fetch_manifest(&selector, override_url, FetchPolicy::CacheAllowed)?;

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Read the wrapped {err} message for the root cause and fix accordingly (network, URL, disk).
  2. Retry the install once connectivity is restored: `baml toolchain install <version>`.
  3. Check the toolchains directory is writable, or use --override-url only with a known-good artifact URL.
Defensive patterns

Strategy: retry

Validate before calling

// check network reachability first
dns.promises.lookup('github.com').catch(() => console.warn('no network; install will fail'));

Try / catch

try {
  execFileSync('baml', ['toolchain', 'install', version]);
} catch (e) {
  console.error(`install failed: ${e.stderr ?? e.message}`); // {err} propagates the fetcher cause
  process.exitCode = 1;
}

Prevention

When it happens

Trigger: Calling `baml toolchain install <version>` where fetcher.install_to_toolchain_root(&toolchains_dir()) returns Err — e.g. network failure, bad artifact URL, corrupt archive, or an unwritable toolchains directory.

Common situations: Offline or proxied environments blocking the download; disk full or permission issues in the toolchains dir; specifying an override_url that serves an invalid artifact.

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/cfcfd5f8920ee64b. Report an issue: GitHub.