{"record":{"id":"36858914eb518e38","repo":"abhigyanpatwari/GitNexus","slug":"cursor-cli-not-found-install-it-from-https-curs","errorCode":null,"errorMessage":"Cursor CLI not found. Install it from https://cursor.com/docs/cli/installation","messagePattern":"Cursor CLI not found\\. Install it from https://cursor\\.com/docs/cli/installation","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"gitnexus/src/core/wiki/cursor-client.ts","lineNumber":72,"sourceCode":"    workingDirectory: overrides?.workingDirectory,\n  };\n}\n\n/**\n * Call the Cursor CLI in print mode.\n *\n * Uses `agent -p --output-format text` for clean non-streaming output.\n * The prompt is passed as the final CLI argument.\n */\nexport async function callCursorLLM(\n  prompt: string,\n  config: CursorConfig,\n  systemPrompt?: string,\n  options?: CallLLMOptions,\n): Promise<LLMResponse> {\n  const cursorBin = detectCursorCLI();\n  if (!cursorBin) {\n    throw new Error(\n      'Cursor CLI not found. Install it from https://cursor.com/docs/cli/installation',\n    );\n  }\n\n  // Always use text format to get clean output without agent narration/thinking.\n  // stream-json captures assistant messages which include \"Let me explore...\" narration\n  // that pollutes the actual content when using thinking models.\n  const fullPrompt = systemPrompt ? `${systemPrompt}\\n\\n---\\n\\n${prompt}` : prompt;\n\n  const args = ['-p', '--output-format', 'text'];\n\n  if (config.model) {\n    args.push('--model', config.model);\n  }\n\n  // Add the prompt as the final argument\n  args.push(fullPrompt);\n","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/abhigyanpatwari/GitNexus/blob/d540b00184d71a896261ee02670da9a92d59d8f7/gitnexus/src/core/wiki/cursor-client.ts#L54-L90","documentation":"Thrown by `callCursorLLM` when `detectCursorCLI()` returns null — the `agent` binary was not found in `PATH`. The detection runs `agent --version` via `execSync` and caches the result; if the command fails for any reason (not installed, not in PATH, permission denied), the cache stores null and all subsequent calls to `callCursorLLM` throw immediately. This is a hard dependency for wiki generation when the Cursor LLM provider is selected.","triggerScenarios":"Wiki generation is configured to use the Cursor CLI as its LLM backend (`callCursorLLM` is invoked), but `execSync('agent --version', { stdio: 'ignore' })` threw — the `agent` binary is not installed or not on PATH.","commonSituations":"Cursor CLI was never installed; it's installed but not on the shell's PATH (common in GUI-launched apps or non-interactive shells); the binary exists but lacks execute permission; a stale cache from a previous failed detection in a long-lived process (the cache is module-level and never invalidated).","solutions":["Install the Cursor CLI from the URL in the error message (https://cursor.com/docs/cli/installation).","Verify the binary is on PATH: run `agent --version` in the same shell/environment where `gitnexus wiki` runs.","If already installed, ensure the directory containing the `agent` binary is in `PATH` for the process running GitNexus.","If the detection was cached as null in a long-lived process (e.g., `gitnexus serve`), restart the process after installing the CLI."],"exampleFix":"# before\n# agent binary not installed\ngitnexus wiki --llm cursor\n# error: Cursor CLI not found. Install it from https://cursor.com/docs/cli/installation\n# after\n# install Cursor CLI per the docs\nagent --version  # verify it's on PATH\ngitnexus wiki --llm cursor","handlingStrategy":"validation","validationCode":"// Before wiki generation with the Cursor provider, verify the CLI is available:\nimport { detectCursorCLI } from './wiki/cursor-client.js';\nif (!detectCursorCLI()) {\n  console.error('Cursor CLI (agent) not found. Install it first.');\n  process.exit(1);\n}","typeGuard":"import { detectCursorCLI } from './wiki/cursor-client.js';\nconst isCursorCliAvailable = (): boolean => detectCursorCLI() !== null;","tryCatchPattern":"try {\n  await callCursorLLM(prompt, config, systemPrompt);\n} catch (err) {\n  if (err instanceof Error && err.message.includes('Cursor CLI not found')) {\n    console.error('Install the Cursor CLI from https://cursor.com/docs/cli/installation');\n    console.error('Verify with: agent --version');\n  }\n  throw err;\n}","preventionTips":["Run `agent --version` in the target environment before relying on the Cursor wiki provider.","Note that `detectCursorCLI` caches its result module-level — restart long-lived processes after installing the CLI.","Consider using a different LLM provider (OpenAI-compatible) if the Cursor CLI is unavailable in your environment."],"tags":["wiki","cursor-cli","dependencies","environment","path"],"backgroundTag":null,"analyzedSha":"d540b00184d71a896261ee02670da9a92d59d8f7","analyzedAt":"2026-08-12T19:50:25.132Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}