BoundaryML/baml · error
failed to install the BAML extension into {ide} automaticall
Error message
failed to install the BAML extension into {ide} automatically: the `{cli}` CLI was not found on PATH.
{help} What it means
`missing_ide_cli_error` builds a contextual error for the case where a specific editor was targeted (via --code/--cursor) but its CLI shim is not installed. It explains that the extension could not be auto-installed and embeds OS-specific manual-install help, since IDEs are often installed without their CLI on PATH.
Source
Thrown at baml_language/crates/baml_cli/src/ide_command.rs:141
"both Cursor and VS Code CLIs were found; rerun with --cursor or --code"
)),
(None, None) => Err(anyhow!(
r"failed to install the BAML extension automatically: no supported IDE CLI (`code` or `cursor`) was found on PATH.
{help}",
help = manual_install_help("VS Code or Cursor", HostOs::CURRENT)
)),
}
}
}
/// The IDE is often installed without its CLI shim (on macOS the `code`
/// and `cursor` commands must be added to PATH by hand from inside the
/// IDE), so a bare not-found error dead-ends users who do have the IDE.
/// Explain what we could not do and walk through the manual install
/// instead.
fn missing_ide_cli_error(ide: &str, cli: &str, os: HostOs) -> anyhow::Error {
anyhow!(
r"failed to install the BAML extension into {ide} automatically: the `{cli}` CLI was not found on PATH.
{help}",
help = manual_install_help(ide, os)
)
}
/// OS-specific wording for the manual-install guidance: the example
/// downloads directory and the Command Palette chord. A parameter of
/// [`manual_install_help`] so tests can cover every variant.
#[derive(Clone, Copy, Debug)]
enum HostOs {
MacOs,
Windows,
Linux,
}
impl HostOs {View on GitHub (pinned to bd85ce9dee)
Solutions
- Install the editor's CLI command into PATH (e.g. VS Code: Cmd+Shift+P > 'Shell Command: Install code command in PATH')
- Follow the manual install steps in the error's help text
- Run the targeted editor if it is a different one than you intended
Defensive patterns
Strategy: validation
Validate before calling
# confirm the targeted CLI exists first baml ide install --code # only if: command -v code baml ide install --cursor # only if: command -v cursor
Try / catch
if let Err(e) = result {
if e.to_string().contains("CLI was not found on PATH") {
eprintln!("Use the manual install instructions from the error help text.");
}
} Prevention
- Only pass --code/--cursor when that CLI is known to be installed
- Document PATH setup for IDE CLIs in onboarding docs
- Prefer the Extensions-UI vsix install on machines without CLI shims
When it happens
Trigger: Running `baml ide install --code` (or --cursor) when that specific CLI is absent from PATH; called from resolve_editor and tests.
Common situations: macOS/Windows installs where the editor exists but its shell command was never added to PATH; CI or SSH environments with only GUI apps installed.
Related errors
- toolchain path is a directory: {}{origin} Point at the {} bi
- toolchain binary not found: {}{origin}
- both Cursor and VS Code CLIs were found; rerun with --cursor
- failed to install the BAML extension automatically: no suppo
- Found none of openapi-generator, openapi-generator-cli, or n
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/f71fbe229cebc8b1.
Report an issue: GitHub.