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

  1. Install the editor's CLI command into PATH (e.g. VS Code: Cmd+Shift+P > 'Shell Command: Install code command in PATH')
  2. Follow the manual install steps in the error's help text
  3. 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

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


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