{"record":{"id":"f7346e1bb24f484d","repo":"thedotmack/claude-mem","slug":"could-not-auto-apply-path-setup-error-instanceo","errorCode":null,"errorMessage":"Could not auto-apply PATH setup: ${error instanceof Error ? error.message : String(error)}","messagePattern":"Could not auto-apply PATH setup: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/npx-cli/commands/install.ts","lineNumber":595,"sourceCode":"      resolve(false);\n    });\n\n    child.on('exit', (code) => {\n      if (code !== 0) {\n        spinner?.error('Claude Code install failed');\n        if (captured) process.stderr.write(captured);\n        log.error(`Claude Code install failed (exit ${code ?? 'unknown'})`);\n        log.info('You can install it manually later: https://claude.ai/install.sh');\n        resolve(false);\n        return;\n      }\n      spinner?.stop('Claude Code installed');\n      if (!IS_WINDOWS) {\n        try {\n          applyClaudeCodePathSetupIfNeeded();\n        } catch (error: unknown) {\n          // [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.\n          log.warn(`Could not auto-apply PATH setup: ${error instanceof Error ? error.message : String(error)}`);\n        }\n      }\n      resolve(true);\n    });\n  });\n}\n\nasync function promptForIDESelection(): Promise<string[]> {\n  let detectedIDEs = detectInstalledIDEs();\n  const claudeCodeInfo = detectedIDEs.find((ide) => ide.id === 'claude-code');\n\n  if (claudeCodeInfo && !claudeCodeInfo.detected) {\n    log.warn('Claude Code is not installed. Claude-mem works best in Claude Code, but also works with the IDEs below.');\n    const choice = await p.select<'install' | 'skip' | 'cancel'>({\n      message: 'Install Claude Code now?',\n      options: [\n        { value: 'install', label: 'Yes — install Claude Code (recommended)' },\n        { value: 'skip', label: 'No — pick another IDE below' },","sourceCodeStart":577,"sourceCodeEnd":613,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/e2d1df569a8f04075d40e92461128ece7cf04c82/src/npx-cli/commands/install.ts#L577-L613","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Manually add the install dir: echo 'export PATH=\"$HOME/.local/bin:$PATH\"' >> ~/.zshrc && source ~/.zshrc","For the current session only: export PATH=\"$HOME/.local/bin:$PATH\"","Fix dotfile permissions (chown/chmod) and re-run the installer for a clean automatic setup"],"exampleFix":"# before: install succeeded but next shell says\n$ claude -v\nclaude: command not found\n\n# after\n$ echo 'export PATH=\"$HOME/.local/bin:$PATH\"' >> ~/.zshrc\n$ exec $SHELL && claude -v","handlingStrategy":"fallback","validationCode":"import { accessSync, constants } from 'node:fs';\nimport { join } from 'node:path';\nfunction binDirWritable(): boolean {\n  try { accessSync(join(process.env.HOME!, '.local', 'bin'), constants.W_OK); return true; } catch { return false; }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["After any installer run, verify `claude -v` in a fresh shell before assuming success","Keep ~/.local/bin on PATH via your shell config so post-install PATH patches are rarely needed","If the warning appears, apply the manual export once — the install itself already succeeded"],"tags":["installer","claude-code","path-setup","post-install","best-effort"],"backgroundTag":"path-setup-failed","analyzedSha":"e2d1df569a8f04075d40e92461128ece7cf04c82","analyzedAt":"2026-08-20T23:58:13.836Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}