{"record":{"id":"cfff5827ec04c260","repo":"thedotmack/claude-mem","slug":"install-worker-shutdown-failed-message","errorCode":null,"errorMessage":"[install] Worker shutdown failed: ${message}","messagePattern":"\\[install\\] Worker shutdown failed: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/npx-cli/commands/install.ts","lineNumber":1904,"sourceCode":"      spinner?.error('Running worker did not stop; refusing to overwrite its live configuration.');\n      installerError(ErrorSeverity.ABORT, {\n        component: 'worker-shutdown',\n        phase,\n        cause: new Error('The existing worker did not stop within 10 seconds.'),\n        remediation: 'Run `npx claude-mem stop`, verify it exits, then run `npx claude-mem install` again.',\n      }, summary);\n    }\n\n    const stopMessage = result.workerWasRunning\n      ? 'Stopped running worker before configuration cutover.'\n      : 'No worker running — proceeding.';\n    if (spinner) spinner.stop(stopMessage);\n    else if (result.workerWasRunning) log.info(stopMessage);\n  } catch (error: unknown) {\n    if (error instanceof InstallAbortError) throw error;\n    const message = error instanceof Error ? error.message : String(error);\n    if (spinner) spinner.error(`Worker shutdown failed: ${message}`);\n    else console.warn('[install] Worker shutdown failed:', message);\n    installerError(ErrorSeverity.ABORT, {\n      component: 'worker-shutdown',\n      phase,\n      cause: error,\n      remediation: 'Run `npx claude-mem stop`, verify it exits, then run `npx claude-mem install` again.',\n    }, summary);\n  }\n}\n\nfunction validateNonInteractiveProvider(\n  options: InstallOptions,\n  summary: InstallSummary,\n): void {\n  if (isInteractive) return;\n\n  if (!options.provider) {\n    installerError(ErrorSeverity.ABORT, {\n      component: 'provider-selection',","sourceCodeStart":1886,"sourceCodeEnd":1922,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/npx-cli/commands/install.ts#L1886-L1922","documentation":"During `claude-mem install`, the installer attempts to shut down any running worker before (re)installing. If worker shutdown fails with any error other than InstallAbortError, the CLI reports 'Worker shutdown failed' and records an ABORT-severity installer error with remediation guidance. It is fatal to that install run because a lingering worker would conflict with the new install.","triggerScenarios":"Calling runInstall when a claude-mem worker process is running and the stop/shutdown call throws — e.g. worker process hung and refuses SIGTERM, PID file stale, or IPC to the worker fails.","commonSituations":"Upgrading/reinstalling while an old worker is still alive; orphaned worker from a previous crash; stale PID/port state after system reboot; permissions preventing signal delivery.","solutions":["Run `npx claude-mem stop`, verify the worker process has exited, then run `npx claude-mem install` again (per the built-in remediation).","If `stop` fails, find and kill the worker process manually (ps/kill by PID or port), remove stale PID files, then reinstall.","Reboot or clear leftover runtime state if the worker keeps respawning, then reinstall."],"exampleFix":"// before: install aborts because worker won't stop\nnpx claude-mem install\n// error: [install] Worker shutdown failed: ...\n// after\nnpx claude-mem stop\nnpx claude-mem install","handlingStrategy":"fallback","validationCode":"// Before installing, verify no worker is running\nimport { execSync } from 'node:child_process';\ntry { execSync('npx claude-mem status', { stdio: 'pipe' }); } catch { /* worker not running */ }","typeGuard":"function isInstallAbortError(e: unknown): e is InstallAbortError { return e instanceof InstallAbortError; }","tryCatchPattern":"try {\n  await stopWorker();\n} catch (error) {\n  if (error instanceof InstallAbortError) throw error;\n  console.warn('Worker shutdown failed:', error instanceof Error ? error.message : String(error));\n  // remediate: npx claude-mem stop, verify exit, reinstall\n}","preventionTips":["Always run `npx claude-mem stop` before reinstalling","Check for orphaned worker processes (ps/pgrep) before install","Remove stale PID files after crashes","Avoid hard-killing workers so shutdown handlers run cleanly"],"tags":["install","worker","process-shutdown","abort"],"backgroundTag":"invalid-state-transition","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"}