thedotmack/claude-mem · error · Error

Found desktop app at

Error message

Found desktop app at ${describedPath} but it doesn't support headless mode. Install Claude Code CLI: npm install -g @anthropic-ai/claude-code

What it means

If the configured binary exists and probes, but its path looks like the Claude Desktop application bundle (looksLikeDesktopAppPath), the library throws: the desktop app cannot run headless the way the memory agents require, so it instructs the user to install the real Claude Code CLI.

Solutions

  1. Install the headless CLI: `npm install -g @anthropic-ai/claude-code`
  2. Point CLAUDE_CODE_PATH in ~/.claude-mem/settings.json at the CLI binary (e.g. ~/.local/bin/claude or the npm global bin), not the Desktop app bundle
  3. Remove CLAUDE_CODE_PATH and let auto-discovery find the CLI on PATH

Example fix

// before (~/.claude-mem/settings.json)
{ "CLAUDE_CODE_PATH": "/Applications/Claude.app/Contents/MacOS/Claude" }

// after
{ "CLAUDE_CODE_PATH": "~/.local/bin/claude" }  // after npm install -g @anthropic-ai/claude-code
Defensive patterns

Strategy: validation

Validate before calling

const p = settings.CLAUDE_CODE_PATH ?? '';
if (/(Claude\.app|Claude\.exe|electron)/i.test(p)) {
  console.warn('CLAUDE_CODE_PATH points at the Desktop app; install the CLI instead: npm install -g @anthropic-ai/claude-code');
}

Type guard

function isDesktopAppBundle(p: string): boolean {
  return /Claude\.app\/Contents|Claude\.exe$/i.test(p);
}

Try / catch

try {
  await findClaudeExecutable();
} catch (e) {
  if (e.message.includes("doesn't support headless mode")) {
    console.error('Install the CLI: npm install -g @anthropic-ai/claude-code');
  } else throw e;
}

Prevention

When it happens

Trigger: probeCandidate returns 'capable' but looksLikeDesktopAppPath(configuredPath) is true — CLAUDE_CODE_PATH points inside the Claude Desktop app bundle (e.g. .../Claude.app/Contents/MacOS/Claude or the Windows desktop executable).

Common situations: User picks the Desktop app binary in a file picker or guesses the path on macOS/Windows; automation scripts resolve `Claude` from /Applications instead of the CLI from npm.

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/93918d518a1cfb16. Report an issue: GitHub.

Appendix: source

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

    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 ${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.`
      );
    }

View on GitHub (pinned to d8bc9755e7)