BoundaryML/baml · error

failed to run {}: {err}{origin}

Error message

failed to run {}: {err}{origin}

What it means

Raised after exec(2) of the resolved toolchain binary failed on unix. The wrapper has already resolved a selector and found the binary path, but the OS refused to execute it — typically a wrong architecture (e.g. arm64 binary on x86), a noexec mount, or a missing ELF interpreter/shebang. The {origin} suffix records how the selector was resolved (env var, project config, or global default) so the failure can be attributed to the right source.

Source

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

    // Deliberately not BAML_WRAPPER_RESOLVED_TOOLCHAIN: that carries a version,
    // and a local build has none. A separate variable also lets the toolchain
    // binary tell the two situations apart, which `baml ide install` needs.
    command.env("BAML_WRAPPER_LOCAL_TOOLCHAIN", cli);

    // Anything verify_path_toolchain could not rule out (wrong architecture,
    // a noexec mount, a missing interpreter) surfaces here, so this message
    // carries the attribution too.
    #[cfg(unix)]
    {
        use std::os::unix::process::CommandExt;
        let err = command.exec();
        Err(anyhow!("failed to exec {}: {err}{origin}", cli.display()))
    }
    #[cfg(not(unix))]
    {
        let status = command
            .status()
            .map_err(|err| anyhow!("failed to run {}: {err}{origin}", cli.display()))?;
        Ok(status.code().unwrap_or(1))
    }
}

fn active_selector() -> Result<ResolvedSelector> {
    if let Ok(value) = env::var("BAML_VERSION") {
        if !value.trim().is_empty() {
            return Ok(ResolvedSelector {
                selector: normalize_selector(value.trim(), &env::current_dir()?),
                source: SelectorSource::Env,
            });
        }
    }
    if let Some((path, selector)) = project_toolchain_selector()? {
        return Ok(ResolvedSelector {
            selector,
            source: SelectorSource::Project(path),
        });

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Run `file <toolchain-path>` on the binary printed in the error to check its architecture matches the host
  2. Check the mount options of the toolchains directory for 'noexec' and remount or move the toolchains dir to an executable filesystem
  3. Run `ldd` or inspect the interpreter line of the binary to find missing dynamic loaders; install them or reinstall the toolchain with `baml toolchain install <version> --force`
  4. If the install is simply broken, reinstall: `baml toolchain install <version> --force`
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at baml_language/crates/baml/src/main.rs:504 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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