BoundaryML/baml · error

failed to install the BAML extension automatically: no suppo

Error message

failed to install the BAML extension automatically: no supported IDE CLI (`code` or `cursor`) was found on PATH.

{help}

What it means

The counterpart of the ambiguity error: when NEITHER `code` nor `cursor` is found on PATH, `resolve_editor` errors with a message that includes OS-specific manual-install instructions generated by manual_install_help.

Source

Thrown at baml_language/crates/baml_cli/src/ide_command.rs:125

    fn resolve_editor(&self) -> Result<OsString> {
        if self.cursor {
            return command_on_path("cursor")
                .ok_or_else(|| missing_ide_cli_error("Cursor", "cursor", HostOs::CURRENT));
        }
        if self.code {
            return command_on_path("code")
                .ok_or_else(|| missing_ide_cli_error("VS Code", "code", HostOs::CURRENT));
        }

        let cursor = command_on_path("cursor");
        let code = command_on_path("code");
        match (cursor, code) {
            (Some(cursor), None) => Ok(cursor),
            (None, Some(code)) => Ok(code),
            (Some(_), Some(_)) => Err(anyhow!(
                "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.

View on GitHub (pinned to bd85ce9dee)

Solutions

  1. Install the CLI shim from inside the IDE (VS Code: 'Shell Command: Install code command in PATH')
  2. Add the editor's bin directory to PATH manually
  3. Follow the manual-install steps printed in the error's {help} section
  4. Alternatively install the .vsix via the editor's Extensions UI
Defensive patterns

Strategy: validation

Validate before calling

# ensure an IDE CLI exists before running
command -v code >/dev/null || command -v cursor >/dev/null || { echo "install the VS Code/Cursor CLI shim first"; exit 1; }

Try / catch

if let Err(e) = result {
    if e.to_string().contains("no supported IDE CLI") {
        eprintln!("Follow the manual-install steps printed above.");
    }
}

Prevention

When it happens

Trigger: Running `baml ide install` on a machine where no supported IDE CLI shim (`code`/`cursor`) is on PATH.

Common situations: macOS installs where the `code`/`cursor` shell commands were never added to PATH from inside the IDE (Cmd+Shift+P > 'Install code command in PATH').

Related errors


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