thedotmack/claude-mem · warning

Could not auto-apply PATH setup: ${error instanceof Error ?

Error message

Could not auto-apply PATH setup: ${error instanceof Error ? error.message : String(error)}

What it means

A log.warn emitted after a SUCCESSFUL Claude Code install on non-Windows: applyClaudeCodePathSetupIfNeeded() threw while trying to persist the new binary's directory into the shell config PATH. It is strictly best-effort — the install itself completed, and only the convenience of auto-PATH is lost. The throw typically wraps the same read/update failures as the shell-config warnings.

Source

Thrown at src/npx-cli/commands/install.ts:595

      resolve(false);
    });

    child.on('exit', (code) => {
      if (code !== 0) {
        spinner?.error('Claude Code install failed');
        if (captured) process.stderr.write(captured);
        log.error(`Claude Code install failed (exit ${code ?? 'unknown'})`);
        log.info('You can install it manually later: https://claude.ai/install.sh');
        resolve(false);
        return;
      }
      spinner?.stop('Claude Code installed');
      if (!IS_WINDOWS) {
        try {
          applyClaudeCodePathSetupIfNeeded();
        } catch (error: unknown) {
          // [ANTI-PATTERN IGNORED]: the failure is already surfaced to the user via the interactive-aware log.warn wrapper below (p.log.warn in a TTY, console.warn otherwise); PATH setup is best-effort after a successful install.
          log.warn(`Could not auto-apply PATH setup: ${error instanceof Error ? error.message : String(error)}`);
        }
      }
      resolve(true);
    });
  });
}

async function promptForIDESelection(): Promise<string[]> {
  let detectedIDEs = detectInstalledIDEs();
  const claudeCodeInfo = detectedIDEs.find((ide) => ide.id === 'claude-code');

  if (claudeCodeInfo && !claudeCodeInfo.detected) {
    log.warn('Claude Code is not installed. Claude-mem works best in Claude Code, but also works with the IDEs below.');
    const choice = await p.select<'install' | 'skip' | 'cancel'>({
      message: 'Install Claude Code now?',
      options: [
        { value: 'install', label: 'Yes — install Claude Code (recommended)' },
        { value: 'skip', label: 'No — pick another IDE below' },

View on GitHub (pinned to e2d1df569a)

Solutions

  1. Manually add the install dir: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc && source ~/.zshrc
  2. For the current session only: export PATH="$HOME/.local/bin:$PATH"
  3. Fix dotfile permissions (chown/chmod) and re-run the installer for a clean automatic setup

Example fix

# before: install succeeded but next shell says
$ claude -v
claude: command not found

# after
$ echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
$ exec $SHELL && claude -v
Defensive patterns

Strategy: fallback

Validate before calling

import { accessSync, constants } from 'node:fs';
import { join } from 'node:path';
function binDirWritable(): boolean {
  try { accessSync(join(process.env.HOME!, '.local', 'bin'), constants.W_OK); return true; } catch { return false; }
}

Prevention

When it happens

Trigger: Claude Code was just installed into ~/.local/bin (or similar) and the PATH-append step hit a read-only/permission-restricted shell config, an unwritable HOME, or a malformed environment during the post-install hook.

Common situations: User completes install, opens a new terminal, and `claude: command not found` because the PATH export never landed; root-owned or read-only dotfiles as in the read/update warnings above.

Related errors


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