thedotmack/claude-mem · error · Error
CLAUDE_CODE_PATH is set to
Error message
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. What it means
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.
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
Example fix
// before (wrapper script) #!/usr/local/bin/node9 // interpreter no longer installed ... // after #!/usr/bin/env node ...
Defensive patterns
Strategy: validation
Validate before calling
import { readFileSync, existsSync } from 'fs';
const p = settings.CLAUDE_CODE_PATH;
if (p && existsSync(p)) {
const first = readFileSync(p, 'utf8').split('\n')[0];
if (first.startsWith('#!')) {
const interp = first.slice(2).trim();
const ipath = interp.startsWith('/usr/bin/env') ? undefined : interp;
if (ipath && !existsSync(ipath)) console.warn(`Broken shebang interpreter: ${ipath}`);
}
} Type guard
null
Try / catch
try {
await findClaudeExecutable();
} catch (e) {
if (e.message.includes('could not be executed')) {
console.error('Reinstall the CLI or fix the shebang/launcher at CLAUDE_CODE_PATH');
} else throw e;
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- CLAUDE_CODE_PATH is set to
- API key prompt cancelled — leaving existing configuration…
- chroma-mcp prewarm failed
- CLAUDE_CODE_PATH is set to
- CLAUDE_CODE_PATH is set to
AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17).
Data as JSON: /api/errors/3a48575deaaba7ac.
Report an issue: GitHub.
Appendix: source
Thrown at src/shared/find-claude-executable.ts:399
`CLAUDE_CODE_PATH is set to ${describedPath} (${probe.version}) but that CLI is too old for claude-mem — ` +
`it rejects flags every memory agent spawn requires (${probe.detail}). ${updateInstructions()}`
);
}
if (looksLikeDesktopAppPath(configuredPath)) {
throw new Error(
`Found desktop app at ${describedPath} but it doesn't support headless mode. ` +
`Install Claude Code CLI: npm install -g @anthropic-ai/claude-code`
);
}
// existsSync passed above, so the file is really there — the probe failed.
// Split the two ways that happens. A launch failure (ENOENT from a launcher
// whose shebang interpreter is missing, or a native-installer stub pointing
// at a deleted version directory) means the OS never ran the file; a
// re-check of the path cannot fix it, so name the likely cause. A process
// that ran but exited non-zero, timed out, or printed no version is a
// different problem — do not claim it "could not be executed".
if (probe.launchFailed) {
throw new Error(
`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.`
);
}
throw new Error(
`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.`
);
}
// --- 2. Probe every discovered candidate ---------------------------------
const capable: Array<{ path: string; version: string; key: [number, number, number]; order: number }> = [];
const incompatible: Array<{ path: string; version: string; detail: string }> = [];
const candidates = discoverCandidates();
for (let order = 0; order < candidates.length; order++) {View on GitHub (pinned to d8bc9755e7)