{"record":{"id":"a6dda4a6585cece6","repo":"thedotmack/claude-mem","slug":"claude-code-path-is-set-to-settings-claude-code-a6dda4","errorCode":null,"errorMessage":"CLAUDE_CODE_PATH is set to \"${settings.CLAUDE_CODE_PATH}\" but it failed the --version check (${probe.detail}). Ensure this is a working Claude Code CLI binary.","messagePattern":"CLAUDE_CODE_PATH is set to \"(.+?)\" but it failed the --version check \\((.+?)\\)\\. Ensure this is a working Claude Code CLI binary\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/shared/find-claude-executable.ts","lineNumber":322,"sourceCode":"        path: configuredPath,\n        version: probe.version,\n        expiresAtMs: Date.now() + RESOLUTION_CACHE_TTL_MS,\n      };\n      return configuredPath;\n    }\n    if (probe.kind === 'incompatible') {\n      throw new Error(\n        `CLAUDE_CODE_PATH is set to \"${settings.CLAUDE_CODE_PATH}\" (${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 \"${settings.CLAUDE_CODE_PATH}\" but it doesn't support headless mode. ` +\n        `Install Claude Code CLI: npm install -g @anthropic-ai/claude-code`\n      );\n    }\n    throw new Error(\n      `CLAUDE_CODE_PATH is set to \"${settings.CLAUDE_CODE_PATH}\" but it failed the --version check (${probe.detail}). ` +\n      `Ensure this is 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;\n    }","sourceCodeStart":304,"sourceCodeEnd":340,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/e2d1df569a8f04075d40e92461128ece7cf04c82/src/shared/find-claude-executable.ts#L304-L340","documentation":"CLAUDE_CODE_PATH exists, is not classified as incompatible or a desktop app, but probeCandidate failed its --version check (probe.detail carries the spawn/parse failure: non-zero exit, unparseable output, spawn error). The binary is present yet cannot prove it is a working Claude Code CLI, so it is rejected rather than trusted.","triggerScenarios":"A shell shim or wrapper as the path (nvm-style wrappers needing shell env, Homebrew indirection shims that misbehave under direct spawn); a binary for the wrong architecture; permission denied (no execute bit); corrupted install producing garbage on --version; required dynamic libraries missing.","commonSituations":"CLAUDE_CODE_PATH pointing at a wrapper script that only works in an interactive shell; macOS ARM binaries on x86 or vice versa; files copied without exec permissions; partially overwritten installs during upgrade.","solutions":["Run `<configured-path> --version` in your own shell and compare — if it fails there too, the binary itself is broken.","Point at the real binary behind any shim (resolve the wrapper) or reinstall the CLI cleanly.","Fix permissions (chmod +x) and architecture mismatches (reinstall for your platform).","If detail mentions spawn errors, check for missing runtime dependencies (node, dynamic libs)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import { execFileSync } from 'child_process';\ntry {\n  const out = execFileSync(configuredPath, ['--version'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] });\n  if (!/\\d+\\.\\d+/.test(out)) throw new Error(`unparseable --version output: ${out.slice(0, 80)}`);\n} catch (e) {\n  throw new Error(`configured CLI fails --version: ${e.message} — point CLAUDE_CODE_PATH at the real binary, not a shim`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Point CLAUDE_CODE_PATH at the real binary, not nvm/brew wrapper shims that need a shell environment.","After cross-machine config sync, re-verify the binary's architecture and exec permissions.","If you wrap the CLI in your own script, make sure it forwards --version and all flags faithfully."],"tags":["executable-resolution","spawn","version-check","setup"],"backgroundTag":"version-probe-failed","analyzedSha":"e2d1df569a8f04075d40e92461128ece7cf04c82","analyzedAt":"2026-08-20T23:58:13.836Z","contentChangedAt":"2026-08-20T23:58:13.836Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}