thedotmack/claude-mem · error · Error

Found desktop app at "${settings.CLAUDE_CODE_PATH}" but it d

Error message

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

What it means

Thrown by findClaudeExecutable when CLAUDE_CODE_PATH exists, is not 'capable' or 'incompatible', and looksLikeDesktopAppPath() returns true — i.e., the path is the Claude desktop app which cannot run in headless mode. The message directs installing the CLI instead.

Source

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

    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()}`
      );
    }
    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);

View on GitHub (pinned to d768ba3643)

Solutions

  1. Install the CLI: `npm install -g @anthropic-ai/claude-code`.
  2. Remove CLAUDE_CODE_PATH from settings so the desktop app path is no longer used.
  3. Point CLAUDE_CODE_PATH to the CLI binary (e.g., output of `which claude`), not the .app bundle.

Example fix

// before: settings.json "CLAUDE_CODE_PATH": "/Applications/Claude.app/Contents/MacOS/claude"
// after: npm install -g @anthropic-ai/claude-code; remove the setting
Defensive patterns

Strategy: validation

Validate before calling

if (looksLikeDesktopAppPath(configuredPath)) {
  throw new Error('CLAUDE_CODE_PATH points to the desktop app — install the CLI instead');
}

Try / catch

try {
  return findClaudeExecutable('SDK');
} catch (err) {
  if (err instanceof Error && /desktop app/.test(err.message)) {
    logger.error('SDK', err.message);
  }
  throw err;
}

Prevention

When it happens

Trigger: CLAUDE_CODE_PATH (or the failed probe) points at the Claude desktop application bundle/binary (looksLikeDesktopAppPath matches) which doesn't support the headless flags the SDK needs.

Common situations: User pointed CLAUDE_CODE_PATH at '/Applications/Claude.app/...' (macOS) or a Windows desktop app path instead of the CLI; auto-discovery would normally skip these but an explicit setting overrides.

Related errors


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