thedotmack/claude-mem · error · Error

Claude executable not found. Please either: 1. Add "claude"…

Error message

Claude executable not found. Please either:
1. Add "claude" to your system PATH, or
2. Set CLAUDE_CODE_PATH in ~/.claude-mem/settings.json

What it means

The terminal failure of findClaudeExecutable: no candidate Claude CLI was found at all (nothing on PATH, no known install locations, no usable CLAUDE_CODE_PATH). It tells the user the two ways to make the CLI discoverable: add `claude` to PATH or set CLAUDE_CODE_PATH in ~/.claude-mem/settings.json.

Solutions

  1. Install the CLI: `npm install -g @anthropic-ai/claude-code`
  2. Verify `claude --version` resolves in the same shell/environment claude-mem runs in (check PATH there); if not, add the install bin dir to PATH
  3. Alternatively set CLAUDE_CODE_PATH in ~/.claude-mem/settings.json to the absolute path of a working claude binary

Example fix

// before: shell
which claude   # not found

// after: shell
npm install -g @anthropic-ai/claude-code
which claude   # /usr/local/bin/claude
Defensive patterns

Strategy: validation

Validate before calling

import { execFileSync } from 'child_process';
let onPath = false;
try { execFileSync('claude', ['--version'], { stdio: 'ignore' }); onPath = true; } catch {}
if (!onPath) console.warn('claude CLI not found; install with: npm install -g @anthropic-ai/claude-code');

Type guard

null

Try / catch

try {
  await findClaudeExecutable();
} catch (e) {
  if (e.message.startsWith('Claude executable not found')) {
    console.error('Install the CLI or set CLAUDE_CODE_PATH in ~/.claude-mem/settings.json');
  } else throw e;
}

Prevention

When it happens

Trigger: Candidate scan yields no existing binaries (or all candidates failed earlier branches), CLAUDE_CODE_PATH is unset/empty, and existsSync fails for every known install path.

Common situations: Fresh machine where Claude Code CLI was never installed; CLI installed via a method the scanner doesn't cover; running inside a container/CI without the CLI; PATH stripped under systemd/cron so `claude` isn't visible.

Related errors


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

Appendix: source

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

    cachedResolution = {
      path: winner.path,
      version: winner.version,
      expiresAtMs: Date.now() + RESOLUTION_CACHE_TTL_MS,
    };
    return winner.path;
  }

  if (incompatible.length > 0) {
    const lines = incompatible
      .map((entry) => `  - ${entry.path} (${entry.version}) — ${entry.detail}`)
      .join('\n');
    throw new Error(
      `Every Claude CLI found is too old for claude-mem (each rejects flags the memory agent passes on every spawn):\n` +
      `${lines}\n${updateInstructions()}`
    );
  }

  throw new Error(
    'Claude executable not found. Please either:\n' +
    '1. Add "claude" to your system PATH, or\n' +
    '2. Set CLAUDE_CODE_PATH in ~/.claude-mem/settings.json'
  );
}

View on GitHub (pinned to d8bc9755e7)