{"record":{"id":"ecd4820d67c13dbc","repo":"BoundaryML/baml","slug":"toolchain-binary-not-found-origin","errorCode":null,"errorMessage":"toolchain binary not found: {}{origin}","messagePattern":"toolchain binary not found: (.+?)(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml/src/main.rs","lineNumber":926,"sourceCode":"        ));\n    }\n    Ok(())\n}\n\n/// Check that a path selector points at something runnable. `origin` is a\n/// pre-formatted `set by ...` line, or empty when the path came straight from\n/// the command line and needs no attribution.\nfn verify_path_toolchain(cli: &Path, origin: &str) -> Result<()> {\n    if cli.is_dir() {\n        return Err(anyhow!(\n            \"toolchain path is a directory: {}{origin}\\nPoint at the {} binary, e.g. {}\",\n            cli.display(),\n            cli_exe_name(),\n            cli.join(\"bin\").join(cli_exe_name()).display()\n        ));\n    }\n    if !cli.exists() {\n        return Err(anyhow!(\n            \"toolchain binary not found: {}{origin}\",\n            cli.display()\n        ));\n    }\n    #[cfg(unix)]\n    {\n        use std::os::unix::fs::PermissionsExt;\n        let mode = fs::metadata(cli)\n            .with_context(|| format!(\"failed to read {}\", cli.display()))?\n            .permissions()\n            .mode();\n        if mode & 0o111 == 0 {\n            return Err(anyhow!(\n                \"toolchain binary is not executable: {}{origin}\",\n                cli.display()\n            ));\n        }\n    }","sourceCodeStart":908,"sourceCodeEnd":944,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml/src/main.rs#L908-L944","documentation":"verify_path_toolchain requires that a path toolchain selector exists on disk. If the given path does not exist at all, the wrapper raises this error instead of attempting to spawn a missing binary. It exists so users get a clear message about the misconfigured path rather than a confusing spawn failure.","triggerScenarios":"Calling print_version, exec_path_toolchain, prepare_toolchain_selector, or status_toolchain with a path selector where `!cli.exists()` — the binary was deleted, moved, or never installed.","commonSituations":"A cached path in a config/env var pointing at a toolchain that was uninstalled or renamed; a typo in the path; stale pins after wiping a toolchains directory; symlinks pointing at removed targets.","solutions":["Verify the file exists at the given path (ls -l <path>) and correct typos.","Install the toolchain (e.g. `baml toolchain install <version>`) or point the selector at an existing binary.","Switch to a managed toolchain: `baml toolchain use <version>` to avoid maintaining raw paths."],"exampleFix":"// before\nbaml --path /opt/baml/0.210.0/bin/baml --version   // binary was removed\n// after\nbaml toolchain install 0.210.0\nbaml --path /opt/baml/0.210.0/bin/baml --version","handlingStrategy":"validation","validationCode":"const p = process.env.BAML_TOOLCHAIN_PATH!;\nif (!fs.existsSync(p)) throw new Error(`toolchain binary missing: ${p}; run 'baml toolchain install <version>'`);","typeGuard":"function toolchainBinaryExists(p: string): boolean {\n  try { return fs.statSync(p).isFile(); } catch { return false; }\n}","tryCatchPattern":"try {\n  execFileSync('baml', ['--version']);\n} catch (e) {\n  if (/toolchain binary not found/.test(e.stderr?.toString() ?? '')) {\n    execFileSync('baml', ['toolchain', 'install', targetVersion]);\n  }\n}","preventionTips":["Re-check env vars/config after uninstalling or moving toolchains.","Run `baml toolchain status` before relying on a path selector.","Avoid hardcoding paths in CI; use managed versions or install steps."],"tags":["cli","toolchain","path","file-not-found"],"backgroundTag":"file-not-found","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"}