thedotmack/claude-mem · error · Error
CLAUDE_CODE_PATH is set to "${settings.CLAUDE_CODE_PATH}" bu
Error message
CLAUDE_CODE_PATH is set to "${settings.CLAUDE_CODE_PATH}" but the file does not exist. What it means
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.
Source
Thrown at src/shared/find-claude-executable.ts:295
export function findClaudeExecutable(logComponent: Component = 'SDK'): string {
if (cachedResolution && cachedResolution.expiresAtMs > Date.now() && _internals.existsSync(cachedResolution.path)) {
return cachedResolution.path;
}
cachedResolution = null;
const settings = _internals.loadSettings();
// --- 1. Explicit configured path ----------------------------------------
if (settings.CLAUDE_CODE_PATH) {
// A user who types `~/.local/bin/claude` in settings.json expects the shell
// convention, but nothing here runs through a shell — existsSync and
// posix_spawn take the string verbatim, so a literal `~` fails with ENOENT.
// Expand it defensively at read time so both the existence check and every
// probe spawn see a real absolute path (SettingsRoutes also normalizes on
// write; this covers files edited by hand).
const configuredPath = expandTilde(settings.CLAUDE_CODE_PATH, _internals.homedir());
if (!_internals.existsSync(configuredPath)) {
throw new Error(
`CLAUDE_CODE_PATH is set to "${settings.CLAUDE_CODE_PATH}" but the file does not exist.`
);
}
const probe = probeCandidate(configuredPath);
if (probe.kind === 'capable') {
logger.info(logComponent, `Using configured CLAUDE_CODE_PATH: ${configuredPath} (${probe.version})`);
cachedResolution = {
path: configuredPath,
version: probe.version,
expiresAtMs: Date.now() + RESOLUTION_CACHE_TTL_MS,
};
return configuredPath;
}
if (probe.kind === 'incompatible') {
throw new Error(
`CLAUDE_CODE_PATH is set to "${settings.CLAUDE_CODE_PATH}" (${probe.version}) but that CLI is too old for claude-mem — ` +
`it rejects flags every memory agent spawn requires (${probe.detail}). ${updateInstructions()}`View on GitHub (pinned to d768ba3643)
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.
Example fix
// settings.json before: "CLAUDE_CODE_PATH": "~//.local/bin/claude" // after (verified): "CLAUDE_CODE_PATH": "/usr/local/bin/claude"
Defensive patterns
Strategy: validation
Validate before calling
import { existsSync } from 'fs';
const settings = loadSettings();
if (settings.CLAUDE_CODE_PATH) {
const p = expandTilde(settings.CLAUDE_CODE_PATH, homedir());
if (!existsSync(p)) {
throw new Error(`CLAUDE_CODE_PATH does not exist: ${p} — fix or remove the setting`);
}
} Try / catch
try {
return findClaudeExecutable('SDK');
} catch (err) {
if (err instanceof Error && /CLAUDE_CODE_PATH.*does not exist/.test(err.message)) {
logger.error('SDK', err.message);
// remove the bad setting or prompt user; fall back is disabled by design
}
throw err;
} Prevention
- 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.
When it happens
Trigger: User set CLAUDE_CODE_PATH in ~/.claude-mem/settings.json to a path that doesn't exist on disk (after ~ expansion).
Common situations: 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.
Related errors
- CLAUDE_CODE_PATH is set to "${settings.CLAUDE_CODE_PATH}" bu
- CLAUDE_CODE_PATH is set to "${settings.CLAUDE_CODE_PATH}" ($
- Found desktop app at "${settings.CLAUDE_CODE_PATH}" but it d
- Invalid CLAUDE_MEM_WORKER_PORT in settings.json: missing
- Invalid CLAUDE_MEM_WORKER_PORT in settings.json: ${rawPort}
AI-assisted analysis of thedotmack/claude-mem@d768ba3643 (2026-08-12).
Data as JSON: /api/errors/d9429303ef5940ab.
Report an issue: GitHub.