thedotmack/claude-mem · error · Error

CLAUDE_CODE_PATH is set to

Error message

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.

What it means

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.

Solutions

  1. Run `<configured-path> --version` in your own shell and compare — if it fails there too, the binary itself is broken.
  2. Point at the real binary behind any shim (resolve the wrapper) or reinstall the CLI cleanly.
  3. Fix permissions (chmod +x) and architecture mismatches (reinstall for your platform).
  4. If detail mentions spawn errors, check for missing runtime dependencies (node, dynamic libs).
Defensive patterns

Strategy: validation

Validate before calling

import { execFileSync } from 'child_process';
try {
  const out = execFileSync(configuredPath, ['--version'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] });
  if (!/\d+\.\d+/.test(out)) throw new Error(`unparseable --version output: ${out.slice(0, 80)}`);
} catch (e) {
  throw new Error(`configured CLI fails --version: ${e.message} — point CLAUDE_CODE_PATH at the real binary, not a shim`);
}

Prevention

When it happens

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

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

Related errors


AI-assisted analysis of thedotmack/claude-mem@e2d1df569a (2026-08-20). Data as JSON: /api/errors/a6dda4a6585cece6. Report an issue: GitHub.

Appendix: source

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

        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()}`
      );
    }
    if (looksLikeDesktopAppPath(configuredPath)) {
      throw new Error(
        `Found desktop app at "${settings.CLAUDE_CODE_PATH}" but it doesn't support headless mode. ` +
        `Install Claude Code CLI: npm install -g @anthropic-ai/claude-code`
      );
    }
    throw new Error(
      `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.`
    );
  }

  // --- 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 e2d1df569a)