{"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":617,"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":599,"sourceCodeEnd":635,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/npx-cli/commands/install.ts#L599-L635","documentation":"installClaudeCode calls applyClaudeCodePathSetupIfNeeded() as a best-effort post-install step on non-Windows systems. If that call throws for any reason, this warning is logged and installation is still reported as successful — only automatic PATH configuration was skipped.","triggerScenarios":"applyClaudeCodePathSetupIfNeeded throws — propagating failures from reading or writing the shell config, mkdir failures for the claude bin dir, or any unexpected error inside PATH setup, right after a successful Claude Code install.","commonSituations":"Read-only or full disk; permission problems in $HOME; unusual SHELL/config file setups; non-standard HOME environments (containers, CI).","solutions":["Add the claude bin dir to PATH manually (the sub-steps log the exact export line).","Check $HOME writability and disk space.","Re-run the installer or the PATH-setup command once the environment issue is fixed.","Verify with `which claude` in a NEW shell session."],"exampleFix":"// before\ntry { applyClaudeCodePathSetupIfNeeded(); } catch (e) { log.warn(`Could not auto-apply PATH setup: ...`); }\n// after (manual fallback)\n// $ echo 'export PATH=\"$HOME/.local/bin:$PATH\"' >> ~/.zshrc\n// $ source ~/.zshrc && which claude","handlingStrategy":"try-catch","validationCode":"// pre-flight before install\nimport { accessSync, constants } from 'fs';\ntry { accessSync(homedir(), constants.W_OK); } catch {\n  console.warn('[install] $HOME is not writable; PATH auto-setup will fail');\n}","typeGuard":null,"tryCatchPattern":"try {\n  applyClaudeCodePathSetupIfNeeded();\n} catch (error: unknown) {\n  log.warn(`Could not auto-apply PATH setup: ${error instanceof Error ? error.message : String(error)}`);\n  // install already succeeded; show manual PATH instructions\n}","preventionTips":["Run the installer as a user with a writable $HOME (avoid sudo-installing into root's home).","Free disk space before installing in constrained environments.","Apply the PATH export manually when warned — installation success is unaffected.","Verify `which claude` in a new shell after any PATH-setup warning."],"tags":["installer","path-setup","best-effort","shell"],"backgroundTag":"file-write-failed","analyzedSha":"d8bc9755e74915e5c3b999181e10a67c889bce2a","analyzedAt":"2026-09-17T16:40:26.182Z","contentChangedAt":"2026-09-17T16:40:26.182Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}