nikivdev/code · error

failed to launch Cursor

Error message

failed to launch Cursor

What it means

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.

Source

Thrown at src/commit.rs:10151

        if bundled.is_file() {
            return Some(bundled);
        }
    }

    None
}

fn open_repo_in_cursor(repo_root: &Path) -> Result<()> {
    if let Some(program) = cursor_cli_program() {
        let status = Command::new(program)
            .arg("--reuse-window")
            .arg(repo_root)
            .stdout(Stdio::null())
            .stderr(Stdio::null())
            .status()
            .context("failed to launch Cursor")?;
        if !status.success() {
            bail!("failed to launch Cursor");
        }
        return Ok(());
    }

    if cfg!(target_os = "macos") {
        let status = Command::new("open")
            .arg("-a")
            .arg("Cursor")
            .arg(repo_root)
            .stdout(Stdio::null())
            .stderr(Stdio::null())
            .status()
            .context("failed to launch Cursor")?;
        if !status.success() {
            bail!("failed to launch Cursor");
        }
        return Ok(());
    }

View on GitHub (pinned to a747e741ae)

Solutions

  1. Verify the CLI exists: `command -v cursor` (install via Cursor's "Install cursor command" if missing).
  2. Run `cursor .` manually to see the real error (the tool suppresses output).
  3. Fix PATH so the `cursor` binary is reachable, or reinstall Cursor.
  4. Fall back to another editor/flow if Cursor is unavailable.

Example fix

// before
f pr open --cursor   # "failed to launch Cursor"
// after
cursor --version     # diagnose: not found -> install CLI / fix PATH
f pr open --cursor
Defensive patterns

Strategy: fallback

Validate before calling

const which = spawnSync("which", ["cursor"]);   // or `command -v cursor`
if (which.status !== 0) { console.error("cursor CLI not on PATH; install it or use another editor"); }

Try / catch

try { openInCursor(repo); }
catch (e) {
  if (String(e).includes("failed to launch Cursor")) {
    openInEditor(repo); // fallback editor
  } else throw e;
}

Prevention

When it happens

Trigger: `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.

Common situations: 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.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/061bc9f216c7b5e6. Report an issue: GitHub.