{"record":{"id":"0a9e78ac1f2e1c6d","repo":"BoundaryML/baml","slug":"toolchain-binary-is-not-executable-origin","errorCode":null,"errorMessage":"toolchain binary is not executable: {}{origin}","messagePattern":"toolchain binary is not executable: (.+?)(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml/src/main.rs","lineNumber":939,"sourceCode":"            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    }\n    Ok(())\n}\n\n/// Bold-yellow lowercase `warning` prefix, matching the styled diagnostics the\n/// toolchain CLI emits (see `baml_exec::diag_print`). Color is dropped\n/// automatically when stderr is not a TTY.\nfn warning_prefix() -> impl std::fmt::Display {\n    console::Style::new()\n        .yellow()\n        .bold()\n        .for_stderr()\n        .apply_to(\"warning\")\n}","sourceCodeStart":921,"sourceCodeEnd":957,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml/src/main.rs#L921-L957","documentation":"On Unix, verify_path_toolchain checks that the path toolchain binary has any execute permission bit set (mode & 0o111). If the file exists but is not executable, the wrapper raises this error before attempting to run it. This usually happens when the binary was downloaded or copied without preserving permissions.","triggerScenarios":"Calling a path-resolving command (print_version, exec_path_toolchain, prepare_toolchain_selector, status_toolchain) with a path selector whose file mode & 0o111 == 0; metadata read failure is separately wrapped as \"failed to read <path>\".","commonSituations":"Copying a baml binary from an archive extracted with non-Unix tools that drop the exec bit; checking the binary into git and checking it out without +x; sharing binaries over network shares.","solutions":["Add the execute bit: chmod +x <path-to-baml-binary>.","Re-extract the toolchain archive with a Unix-native tool (tar) so permissions are preserved.","Reinstall the toolchain via `baml toolchain install <version>`."],"exampleFix":"// before\nls -l toolchain/bin/baml  # -rw-r--r-- (not executable)\n// after\nchmod +x toolchain/bin/baml","handlingStrategy":"validation","validationCode":"const p = '/opt/baml/0.210.0/bin/baml';\nif ((fs.statSync(p).mode & 0o111) === 0) fs.chmodSync(p, 0o755);","typeGuard":"function isExecutable(p: string): boolean {\n  try { return (fs.statSync(p).mode & 0o111) !== 0; } catch { return false; }\n}","tryCatchPattern":null,"preventionTips":["After extracting archives, run chmod +x on the binaries.","Configure git with `git update-index --chmod=+x` for checked-in binaries or use core.fileMode appropriately.","Reinstall via `baml toolchain install` instead of manually copying binaries."],"tags":["cli","toolchain","permissions","unix"],"backgroundTag":"permission-denied","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"}