{"record":{"id":"061bc9f216c7b5e6","repo":"nikivdev/code","slug":"failed-to-launch-cursor","errorCode":null,"errorMessage":"failed to launch Cursor","messagePattern":"failed to launch Cursor","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/commit.rs","lineNumber":10151,"sourceCode":"        if bundled.is_file() {\n            return Some(bundled);\n        }\n    }\n\n    None\n}\n\nfn open_repo_in_cursor(repo_root: &Path) -> Result<()> {\n    if let Some(program) = cursor_cli_program() {\n        let status = Command::new(program)\n            .arg(\"--reuse-window\")\n            .arg(repo_root)\n            .stdout(Stdio::null())\n            .stderr(Stdio::null())\n            .status()\n            .context(\"failed to launch Cursor\")?;\n        if !status.success() {\n            bail!(\"failed to launch Cursor\");\n        }\n        return Ok(());\n    }\n\n    if cfg!(target_os = \"macos\") {\n        let status = Command::new(\"open\")\n            .arg(\"-a\")\n            .arg(\"Cursor\")\n            .arg(repo_root)\n            .stdout(Stdio::null())\n            .stderr(Stdio::null())\n            .status()\n            .context(\"failed to launch Cursor\")?;\n        if !status.success() {\n            bail!(\"failed to launch Cursor\");\n        }\n        return Ok(());\n    }","sourceCodeStart":10133,"sourceCodeEnd":10169,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/commit.rs#L10133-L10169","documentation":"The helper that opens the repo in the Cursor editor launches the `cursor` binary with the repo root, discarding stdout/stderr, and requires a successful exit status. It bails with \"failed to launch Cursor\" via `.context(...)` when spawning fails (e.g. binary not found) and directly when the process exits non-zero. Because output is suppressed, the underlying OS/exit error is hidden behind this message.","triggerScenarios":"`cursor` is not installed or not on PATH (spawn fails with 'No such file or directory'); the binary exists but exits non-zero (crash, bad install); sandboxed environment blocks exec.","commonSituations":"Cursor installed as a GUI app without its `cursor` CLI shim on PATH; PATH differing under the shell/CI vs interactive environment; stale symlink after an app update or uninstall.","solutions":["Verify the CLI exists: `command -v cursor` (install via Cursor's \"Install cursor command\" if missing).","Run `cursor .` manually to see the real error (the tool suppresses output).","Fix PATH so the `cursor` binary is reachable, or reinstall Cursor.","Fall back to another editor/flow if Cursor is unavailable."],"exampleFix":"// before\nf pr open --cursor   # \"failed to launch Cursor\"\n// after\ncursor --version     # diagnose: not found -> install CLI / fix PATH\nf pr open --cursor","handlingStrategy":"fallback","validationCode":"const which = spawnSync(\"which\", [\"cursor\"]);   // or `command -v cursor`\nif (which.status !== 0) { console.error(\"cursor CLI not on PATH; install it or use another editor\"); }","typeGuard":null,"tryCatchPattern":"try { openInCursor(repo); }\ncatch (e) {\n  if (String(e).includes(\"failed to launch Cursor\")) {\n    openInEditor(repo); // fallback editor\n  } else throw e;\n}","preventionTips":["Install Cursor's CLI shim and confirm `cursor --version` works.","Ensure PATH in scripts/CI matches your interactive shell.","Run `cursor .` manually once to surface hidden startup errors.","Clean up stale symlinks after Cursor updates/uninstalls."],"tags":["editor","process-spawn","cursor","path"],"backgroundTag":"command-not-found","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}