{"record":{"id":"3a48575deaaba7ac","repo":"thedotmack/claude-mem","slug":"claude-code-path-is-set-to-describedpath-the-file-exists-but","errorCode":null,"errorMessage":"CLAUDE_CODE_PATH is set to ${describedPath} — the file exists but could not be executed (${probe.detail}). A launcher script whose interpreter (shebang) is missing, or a native-installer stub pointing at a deleted version directory, fails this way. Reinstall the Claude Code CLI or point CLAUDE_CODE_PATH at a working binary.","messagePattern":"CLAUDE_CODE_PATH is set to (.+?) — the file exists but could not be executed \\((.+?)\\)\\. A launcher script whose interpreter \\(shebang\\) is missing, or a native-installer stub pointing at a deleted version directory, fails this way\\. Reinstall the Claude Code CLI or point CLAUDE_CODE_PATH at a working binary\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/shared/find-claude-executable.ts","lineNumber":399,"sourceCode":"        `CLAUDE_CODE_PATH is set to ${describedPath} (${probe.version}) but that CLI is too old for claude-mem — ` +\n        `it rejects flags every memory agent spawn requires (${probe.detail}). ${updateInstructions()}`\n      );\n    }\n    if (looksLikeDesktopAppPath(configuredPath)) {\n      throw new Error(\n        `Found desktop app at ${describedPath} but it doesn't support headless mode. ` +\n        `Install Claude Code CLI: npm install -g @anthropic-ai/claude-code`\n      );\n    }\n    // existsSync passed above, so the file is really there — the probe failed.\n    // Split the two ways that happens. A launch failure (ENOENT from a launcher\n    // whose shebang interpreter is missing, or a native-installer stub pointing\n    // at a deleted version directory) means the OS never ran the file; a\n    // re-check of the path cannot fix it, so name the likely cause. A process\n    // that ran but exited non-zero, timed out, or printed no version is a\n    // different problem — do not claim it \"could not be executed\".\n    if (probe.launchFailed) {\n      throw new Error(\n        `CLAUDE_CODE_PATH is set to ${describedPath} — the file exists but could not be executed (${probe.detail}). ` +\n        `A launcher script whose interpreter (shebang) is missing, or a native-installer stub pointing at a deleted version directory, fails this way. ` +\n        `Reinstall the Claude Code CLI or point CLAUDE_CODE_PATH at a working binary.`\n      );\n    }\n    throw new Error(\n      `CLAUDE_CODE_PATH is set to ${describedPath} — the file ran but failed its version probe (${probe.detail}). ` +\n      `It may be the wrong program, or a wrapper that errors before printing a version. ` +\n      `Ensure CLAUDE_CODE_PATH points at a working Claude Code CLI binary.`\n    );\n  }\n\n  // --- 2. Probe every discovered candidate ---------------------------------\n  const capable: Array<{ path: string; version: string; key: [number, number, number]; order: number }> = [];\n  const incompatible: Array<{ path: string; version: string; detail: string }> = [];\n\n  const candidates = discoverCandidates();\n  for (let order = 0; order < candidates.length; order++) {","sourceCodeStart":381,"sourceCodeEnd":417,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/shared/find-claude-executable.ts#L381-L417","documentation":"The configured CLAUDE_CODE_PATH file exists, but the OS could not launch it at all (probe.launchFailed). The library names the two canonical causes — a launcher script whose shebang interpreter is missing, or a native-installer stub pointing at a deleted version directory — and asks the user to reinstall or re-point the setting.","triggerScenarios":"existsSync passed, but probeCandidate's spawn fails at launch (ENOENT of the interpreter named in the shebang, or the native-installer stub's target version directory no longer exists).","commonSituations":"Editing a `claude` wrapper script by hand and breaking the shebang; the native installer's `~/.local/share/claude/versions/<x>` directory pruned while the stub symlink/script remained; permissions making the interpreter unresolvable.","solutions":["Reinstall Claude Code CLI (`npm install -g @anthropic-ai/claude-code` or re-run the native installer) to restore a working binary","Inspect the file's first line (`head -1 <path>`); fix or remove a broken shebang in wrapper scripts","Point CLAUDE_CODE_PATH at a known-good binary, or delete the setting to use PATH discovery"],"exampleFix":"// before (wrapper script)\n#!/usr/local/bin/node9   // interpreter no longer installed\n...\n\n// after\n#!/usr/bin/env node\n...","handlingStrategy":"validation","validationCode":"import { readFileSync, existsSync } from 'fs';\nconst p = settings.CLAUDE_CODE_PATH;\nif (p && existsSync(p)) {\n  const first = readFileSync(p, 'utf8').split('\\n')[0];\n  if (first.startsWith('#!')) {\n    const interp = first.slice(2).trim();\n    const ipath = interp.startsWith('/usr/bin/env') ? undefined : interp;\n    if (ipath && !existsSync(ipath)) console.warn(`Broken shebang interpreter: ${ipath}`);\n  }\n}","typeGuard":"null","tryCatchPattern":"try {\n  await findClaudeExecutable();\n} catch (e) {\n  if (e.message.includes('could not be executed')) {\n    console.error('Reinstall the CLI or fix the shebang/launcher at CLAUDE_CODE_PATH');\n  } else throw e;\n}","preventionTips":["Use `#!/usr/bin/env node` style shebangs that resolve on any machine","Re-run the native installer after pruning version directories","Verify wrapper scripts with a direct execution test before configuring them"],"tags":["process-spawn","broken-symlink","cli"],"backgroundTag":"command-not-found","analyzedSha":"d8bc9755e74915e5c3b999181e10a67c889bce2a","analyzedAt":"2026-09-17T16:40:26.182Z","contentChangedAt":"2026-09-17T16:40:26.182Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}