{"record":{"id":"5dfaae60d036f328","repo":"BoundaryML/baml","slug":"both-cursor-and-vs-code-clis-were-found-rerun-with-cursor-or","errorCode":null,"errorMessage":"both Cursor and VS Code CLIs were found; rerun with --cursor or --code","messagePattern":"both Cursor and VS Code CLIs were found; rerun with --cursor or --code","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"baml_language/crates/baml_cli/src/ide_command.rs","lineNumber":122,"sourceCode":"        Ok(ExitCode::Success)\n    }\n\n    fn resolve_editor(&self) -> Result<OsString> {\n        if self.cursor {\n            return command_on_path(\"cursor\")\n                .ok_or_else(|| missing_ide_cli_error(\"Cursor\", \"cursor\", HostOs::CURRENT));\n        }\n        if self.code {\n            return command_on_path(\"code\")\n                .ok_or_else(|| missing_ide_cli_error(\"VS Code\", \"code\", HostOs::CURRENT));\n        }\n\n        let cursor = command_on_path(\"cursor\");\n        let code = command_on_path(\"code\");\n        match (cursor, code) {\n            (Some(cursor), None) => Ok(cursor),\n            (None, Some(code)) => Ok(code),\n            (Some(_), Some(_)) => Err(anyhow!(\n                \"both Cursor and VS Code CLIs were found; rerun with --cursor or --code\"\n            )),\n            (None, None) => Err(anyhow!(\n                r\"failed to install the BAML extension automatically: no supported IDE CLI (`code` or `cursor`) was found on PATH.\n\n{help}\",\n                help = manual_install_help(\"VS Code or Cursor\", HostOs::CURRENT)\n            )),\n        }\n    }\n}\n\n/// The IDE is often installed without its CLI shim (on macOS the `code`\n/// and `cursor` commands must be added to PATH by hand from inside the\n/// IDE), so a bare not-found error dead-ends users who do have the IDE.\n/// Explain what we could not do and walk through the manual install\n/// instead.\nfn missing_ide_cli_error(ide: &str, cli: &str, os: HostOs) -> anyhow::Error {","sourceCodeStart":104,"sourceCodeEnd":140,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_cli/src/ide_command.rs#L104-L140","documentation":"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.","triggerScenarios":"Running `baml ide install` (without --cursor/--code) on a machine where both `cursor` and `code` are on PATH.","commonSituations":"Developers with both VS Code and Cursor installed — very common after switching editors.","solutions":["Re-run with an explicit target: `baml ide install --code` or `baml ide install --cursor`"],"exampleFix":"// before\n$ baml ide install\n// after\n$ baml ide install --cursor","handlingStrategy":"validation","validationCode":"# disambiguate before invoking\nif command -v code >/dev/null && command -v cursor >/dev/null; then\n  baml ide install --code   # or --cursor\nelse\n  baml ide install\nfi","typeGuard":null,"tryCatchPattern":"if let Err(e) = result {\n    if e.to_string().contains(\"--cursor or --code\") {\n        // prompt user which editor to target, then retry with the flag\n    }\n}","preventionTips":["Always pass --code or --cursor explicitly in scripts","Set a team convention for which editor BAML extension targets"],"tags":["cli","ide","ambiguous"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}