{"record":{"id":"af8989cf56f37636","repo":"thedotmack/claude-mem","slug":"claude-code-path-is-set-to-describedpath-the-file-ran-but","errorCode":null,"errorMessage":"CLAUDE_CODE_PATH is set to ${describedPath} — the file ran but failed its version probe (${probe.detail}). It may be the wrong program, or a wrapper that errors before printing a version. Ensure CLAUDE_CODE_PATH points at a working Claude Code CLI binary.","messagePattern":"CLAUDE_CODE_PATH is set to (.+?) — the file ran but failed its version probe \\((.+?)\\)\\. It may be the wrong program, or a wrapper that errors before printing a version\\. Ensure CLAUDE_CODE_PATH points at a working Claude Code CLI binary\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/shared/find-claude-executable.ts","lineNumber":405,"sourceCode":"        `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++) {\n    const candidate = candidates[order];\n    const probe = probeCandidate(candidate);\n\n    if (probe.kind === 'capable') {\n      capable.push({ path: candidate, version: probe.version, key: parseVersionKey(probe.version), order });\n      continue;","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/shared/find-claude-executable.ts#L387-L423","documentation":"The configured CLAUDE_CODE_PATH file exists and the OS launched it, but it failed the version probe — it exited non-zero, timed out, or printed no version. The library distinguishes this from a launch failure (163) and concludes the file is probably the wrong program or a wrapper that errors before printing a version.","triggerScenarios":"probe.launchFailed is false but probeCandidate returns a failure kind: the spawned process ran yet exited non-zero, hung past the probe timeout, or its stdout contained no parseable version.","commonSituations":"Pointing CLAUDE_CODE_PATH at a shell wrapper that logs to stdout before exec'ing claude; pointing at an unrelated binary that happens to be named claude; a sandbox/antivirus blocking the child; corrupted node_modules bin shim.","solutions":["Run the configured binary directly with `--version` and fix whatever it prints/fails with","Point CLAUDE_CODE_PATH at the real CLI binary rather than a wrapper; remove the setting to auto-discover","Reinstall Claude Code CLI if the bin shim is corrupted (`npm install -g @anthropic-ai/claude-code`)"],"exampleFix":"// before (~/.claude-mem/settings.json)\n{ \"CLAUDE_CODE_PATH\": \"~/bin/claude-wrapper\" }  // wrapper errors before printing a version\n\n// after\n{ \"CLAUDE_CODE_PATH\": \"~/.local/bin/claude\" }  // `claude --version` works directly","handlingStrategy":"validation","validationCode":"import { execFileSync } from 'child_process';\ntry {\n  execFileSync(settings.CLAUDE_CODE_PATH, ['--version'], { encoding: 'utf8', timeout: 10000, stdio: 'pipe' });\n} catch (e) {\n  console.warn(`Configured binary fails --version probe: ${e.message}`);\n}","typeGuard":"null","tryCatchPattern":"try {\n  await findClaudeExecutable();\n} catch (e) {\n  if (e.message.includes('failed its version probe')) {\n    console.error(`Fix or replace the program at CLAUDE_CODE_PATH: ${e.message}`);\n  } else throw e;\n}","preventionTips":["Keep wrappers silent on stdout (log to stderr) so the version line is parseable","Point CLAUDE_CODE_PATH at the real CLI binary, not wrappers or unrelated tools","Test with `<path> --version` after any environment/security software change"],"tags":["process-spawn","cli","configuration"],"backgroundTag":"invalid-config-value","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"}