{"record":{"id":"d9429303ef5940ab","repo":"thedotmack/claude-mem","slug":"claude-code-path-is-set-to-settings-claude-code","errorCode":null,"errorMessage":"CLAUDE_CODE_PATH is set to \"${settings.CLAUDE_CODE_PATH}\" but the file does not exist.","messagePattern":"CLAUDE_CODE_PATH is set to \"(.+?)\" but the file does not exist\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/shared/find-claude-executable.ts","lineNumber":295,"sourceCode":"export function findClaudeExecutable(logComponent: Component = 'SDK'): string {\n  if (cachedResolution && cachedResolution.expiresAtMs > Date.now() && _internals.existsSync(cachedResolution.path)) {\n    return cachedResolution.path;\n  }\n  cachedResolution = null;\n\n  const settings = _internals.loadSettings();\n\n  // --- 1. Explicit configured path ----------------------------------------\n  if (settings.CLAUDE_CODE_PATH) {\n    // A user who types `~/.local/bin/claude` in settings.json expects the shell\n    // convention, but nothing here runs through a shell — existsSync and\n    // posix_spawn take the string verbatim, so a literal `~` fails with ENOENT.\n    // Expand it defensively at read time so both the existence check and every\n    // probe spawn see a real absolute path (SettingsRoutes also normalizes on\n    // write; this covers files edited by hand).\n    const configuredPath = expandTilde(settings.CLAUDE_CODE_PATH, _internals.homedir());\n    if (!_internals.existsSync(configuredPath)) {\n      throw new Error(\n        `CLAUDE_CODE_PATH is set to \"${settings.CLAUDE_CODE_PATH}\" but the file does not exist.`\n      );\n    }\n\n    const probe = probeCandidate(configuredPath);\n    if (probe.kind === 'capable') {\n      logger.info(logComponent, `Using configured CLAUDE_CODE_PATH: ${configuredPath} (${probe.version})`);\n      cachedResolution = {\n        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()}`","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d768ba364302d12b76e69e4f021f0bb1d2d50ed6/src/shared/find-claude-executable.ts#L277-L313","documentation":"Thrown by findClaudeExecutable when settings.CLAUDE_CODE_PATH is set but, after tilde expansion, existsSync reports the file does not exist. This is the first resolution strategy (explicit configured path); it fails loud rather than silently falling through, so a misconfigured path is obvious. Resolution stops here — no PATH probing occurs.","triggerScenarios":"User set CLAUDE_CODE_PATH in ~/.claude-mem/settings.json to a path that doesn't exist on disk (after ~ expansion).","commonSituations":"Typo in the path; binary moved/removed after upgrade; literal '~' that doesn't expand to a real path; settings edited by hand with a relative path; different machine where the path differs.","solutions":["Verify the path exists: `ls -la <expanded-path>` (remember ~ is expanded to $HOME).","Correct or remove CLAUDE_CODE_PATH in ~/.claude-mem/settings.json to let PATH auto-discovery run.","If you moved claude, update the setting to the new absolute location.","Run `which claude` and paste that absolute path into the setting."],"exampleFix":"// settings.json before: \"CLAUDE_CODE_PATH\": \"~//.local/bin/claude\"\n// after (verified): \"CLAUDE_CODE_PATH\": \"/usr/local/bin/claude\"","handlingStrategy":"validation","validationCode":"import { existsSync } from 'fs';\nconst settings = loadSettings();\nif (settings.CLAUDE_CODE_PATH) {\n  const p = expandTilde(settings.CLAUDE_CODE_PATH, homedir());\n  if (!existsSync(p)) {\n    throw new Error(`CLAUDE_CODE_PATH does not exist: ${p} — fix or remove the setting`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  return findClaudeExecutable('SDK');\n} catch (err) {\n  if (err instanceof Error && /CLAUDE_CODE_PATH.*does not exist/.test(err.message)) {\n    logger.error('SDK', err.message);\n    // remove the bad setting or prompt user; fall back is disabled by design\n  }\n  throw err;\n}","preventionTips":["Validate CLAUDE_CODE_PATH exists before relying on it.","Use absolute paths (no '~') in settings, or rely on the built-in tilde expansion.","After moving/removing claude, update or delete the setting."],"tags":["config","claude-cli","path-resolution","settings"],"backgroundTag":null,"analyzedSha":"d768ba364302d12b76e69e4f021f0bb1d2d50ed6","analyzedAt":"2026-08-12T23:52:55.241Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}