BoundaryML/baml · error
both Cursor and VS Code CLIs were found; rerun with --cursor
Error message
both Cursor and VS Code CLIs were found; rerun with --cursor or --code
What it means
Ambiguity guard in `baml ide install`: both a `cursor` and a `code` CLI were found on PATH and neither --cursor nor --code was passed, so the installer cannot know which editor's extensions directory to target. The resolver lists both and requires an explicit disambiguating flag.
Source
Thrown at baml_language/crates/baml_cli/src/ide_command.rs:122
Ok(ExitCode::Success)
}
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 {View on GitHub (pinned to bd85ce9dee)
Solutions
- Re-run with an explicit target: `baml ide install --code` or `baml ide install --cursor`
Example fix
// before $ baml ide install // after $ baml ide install --cursor
Defensive patterns
Strategy: validation
Validate before calling
# disambiguate before invoking if command -v code >/dev/null && command -v cursor >/dev/null; then baml ide install --code # or --cursor else baml ide install fi
Try / catch
if let Err(e) = result {
if e.to_string().contains("--cursor or --code") {
// prompt user which editor to target, then retry with the flag
}
} Prevention
- Always pass --code or --cursor explicitly in scripts
- Set a team convention for which editor BAML extension targets
When it happens
Trigger: Running `baml ide install` (without --cursor/--code) on a machine where both `cursor` and `code` are on PATH.
Common situations: Developers with both VS Code and Cursor installed — very common after switching editors.
Understand the failure class
Background: "mutually exclusive" flag errors: what "can't supply both nx and xx", "--raw is not compatible with -i" and "cannot be used with" mean, and how to fix them — this error's family across 29 libraries.
Related errors
- failed to install the BAML extension into {ide} automaticall
- usage: baml self-update unexpected arguments: {}
- usage: baml toolchain install <canary|nightly|version>
- usage: baml toolchain use <canary|nightly|version|path>
- usage: baml toolchain pin <canary|nightly|version|path>
AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12).
Data as JSON: /api/errors/5dfaae60d036f328.
Report an issue: GitHub.