{"record":{"id":"90b8ecc5bb67548a","repo":"BoundaryML/baml","slug":"failed-to-run-err-origin","errorCode":null,"errorMessage":"failed to run {}: {err}{origin}","messagePattern":"failed to run (.+?): (.+?)(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml/src/main.rs","lineNumber":504,"sourceCode":"    // Deliberately not BAML_WRAPPER_RESOLVED_TOOLCHAIN: that carries a version,\n    // and a local build has none. A separate variable also lets the toolchain\n    // binary tell the two situations apart, which `baml ide install` needs.\n    command.env(\"BAML_WRAPPER_LOCAL_TOOLCHAIN\", cli);\n\n    // Anything verify_path_toolchain could not rule out (wrong architecture,\n    // a noexec mount, a missing interpreter) surfaces here, so this message\n    // carries the attribution too.\n    #[cfg(unix)]\n    {\n        use std::os::unix::process::CommandExt;\n        let err = command.exec();\n        Err(anyhow!(\"failed to exec {}: {err}{origin}\", cli.display()))\n    }\n    #[cfg(not(unix))]\n    {\n        let status = command\n            .status()\n            .map_err(|err| anyhow!(\"failed to run {}: {err}{origin}\", cli.display()))?;\n        Ok(status.code().unwrap_or(1))\n    }\n}\n\nfn active_selector() -> Result<ResolvedSelector> {\n    if let Ok(value) = env::var(\"BAML_VERSION\") {\n        if !value.trim().is_empty() {\n            return Ok(ResolvedSelector {\n                selector: normalize_selector(value.trim(), &env::current_dir()?),\n                source: SelectorSource::Env,\n            });\n        }\n    }\n    if let Some((path, selector)) = project_toolchain_selector()? {\n        return Ok(ResolvedSelector {\n            selector,\n            source: SelectorSource::Project(path),\n        });","sourceCodeStart":486,"sourceCodeEnd":522,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml/src/main.rs#L486-L522","documentation":"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.","triggerScenarios":"Thrown at baml_language/crates/baml/src/main.rs:504 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run `file <toolchain-path>` on the binary printed in the error to check its architecture matches the host","Check the mount options of the toolchains directory for 'noexec' and remount or move the toolchains dir to an executable filesystem","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`","If the install is simply broken, reinstall: `baml toolchain install <version> --force`"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}