thedotmack/claude-mem · error · Error

CLAUDE_CODE_PATH is set to

Error message

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.

What it means

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.

Solutions

  1. Run the configured binary directly with `--version` and fix whatever it prints/fails with
  2. Point CLAUDE_CODE_PATH at the real CLI binary rather than a wrapper; remove the setting to auto-discover
  3. Reinstall Claude Code CLI if the bin shim is corrupted (`npm install -g @anthropic-ai/claude-code`)

Example fix

// before (~/.claude-mem/settings.json)
{ "CLAUDE_CODE_PATH": "~/bin/claude-wrapper" }  // wrapper errors before printing a version

// after
{ "CLAUDE_CODE_PATH": "~/.local/bin/claude" }  // `claude --version` works directly
Defensive patterns

Strategy: validation

Validate before calling

import { execFileSync } from 'child_process';
try {
  execFileSync(settings.CLAUDE_CODE_PATH, ['--version'], { encoding: 'utf8', timeout: 10000, stdio: 'pipe' });
} catch (e) {
  console.warn(`Configured binary fails --version probe: ${e.message}`);
}

Type guard

null

Try / catch

try {
  await findClaudeExecutable();
} catch (e) {
  if (e.message.includes('failed its version probe')) {
    console.error(`Fix or replace the program at CLAUDE_CODE_PATH: ${e.message}`);
  } else throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17). Data as JSON: /api/errors/af8989cf56f37636. Report an issue: GitHub.

Appendix: source

Thrown at src/shared/find-claude-executable.ts:405

        `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++) {
    const candidate = candidates[order];
    const probe = probeCandidate(candidate);

    if (probe.kind === 'capable') {
      capable.push({ path: candidate, version: probe.version, key: parseVersionKey(probe.version), order });
      continue;

View on GitHub (pinned to d8bc9755e7)