thedotmack/claude-mem · warning
Worker shutdown attempt failed: ${error instanceof Error ? e
Error message
Worker shutdown attempt failed: ${error instanceof Error ? error.message : String(error)} What it means
During `npx claude-mem uninstall`, the command attempts to stop the running worker service before cleanup. If the shutdown call itself throws (as opposed to merely reporting it did not stop), the error is caught and logged to console.warn as '[uninstall] Worker shutdown attempt failed: <message>', and uninstall continues. Unlike install, this is non-fatal by design: cleanup proceeds even if shutdown could not be attempted.
Source
Thrown at src/npx-cli/commands/uninstall.ts:280
initialValue: false,
});
if (p.isCancel(shouldContinue) || !shouldContinue) {
p.cancel('Uninstall cancelled.');
return;
}
}
const workerPort = SettingsDefaultsManager.get('CLAUDE_MEM_WORKER_PORT');
try {
const result = await shutdownWorkerAndWait(workerPort, 10000);
if (result.workerWasRunning && result.stopped) {
p.log.info('Worker service stopped.');
} else if (result.workerWasRunning) {
p.log.warn('Worker service did not confirm shutdown; continuing uninstall cleanup.');
}
} catch (error: unknown) {
console.warn('[uninstall] Worker shutdown attempt failed:', error instanceof Error ? error.message : String(error));
}
// #2568 — server-runtime teardown. Gated on the installed/selected runtime so
// the worker uninstall path is completely unchanged. The bundled Docker
// compose stack lives under the marketplace dir; if it's present we treat the
// stack as locally managed and instruct teardown (the actual `docker compose
// down -v` is an operator/CI side effect, not run from this Node process).
const selectedRuntime = readSelectedRuntime();
if (selectedRuntime === 'server') {
if (existsSync(join(marketplaceDirectory(), 'docker-compose.yml'))) {
p.log.info(
'Server runtime detected. Tear down the bundled stack with '
+ '`docker compose down -v --remove-orphans` (stops + removes pg + redis/valkey).',
);
} else {
p.log.info('Server runtime detected (externally managed stack — leaving Docker/pg/redis untouched).');
}
clearServerRuntimeSettings(SERVER_RUNTIME_SETTINGS_KEYS);View on GitHub (pinned to 8bc631a71a)
Solutions
- Ignore it if uninstall completed — cleanup continues by design; verify no worker process remains afterward.
- Run `npx claude-mem stop` or manually kill the worker process after uninstall.
- Check CLAUDE_MEM_WORKER_PORT is a valid port number in settings.
- Re-run uninstall to confirm the worker is no longer running.
Example fix
// before npx claude-mem uninstall // warns: Worker shutdown attempt failed: ... // after ps aux | grep claude-mem # confirm/kill leftover worker npx claude-mem uninstall
Defensive patterns
Strategy: try-catch
Validate before calling
const port = Number(settings.CLAUDE_MEM_WORKER_PORT);
if (!Number.isInteger(port) || port <= 0 || port > 65535) console.warn('invalid worker port; fix settings before uninstall'); Try / catch
try {
await shutdownWorkerAndWait(workerPort, 10000);
} catch (error) {
console.warn('[uninstall] Worker shutdown attempt failed:', error instanceof Error ? error.message : String(error));
// continue cleanup; verify no leftover worker afterward
} Prevention
- Ensure CLAUDE_MEM_WORKER_PORT is set to a valid port before running uninstall.
- Check for a live worker (health endpoint) before uninstall and stop it gracefully.
- Treat the warning as a signal to manually verify/kill leftover worker processes.
- Re-run uninstall to confirm a clean state.
When it happens
Trigger: runUninstallCommand calls shutdownWorkerAndWait(workerPort, 10000) and that call throws — e.g. an invalid CLAUDE_MEM_WORKER_PORT setting, a network error contacting the worker, or an unexpected exception inside the shutdown helper.
Common situations: Worker already crashed leaving a half-open socket; CLAUDE_MEM_WORKER_PORT setting missing or invalid; the 10s timeout window expiring and the helper throwing instead of returning stopped:false; OS-level restrictions on signalling the worker process.
Understand the failure class
Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.
Related errors
- [uninstall] Worker shutdown attempt failed:
- Worker shutdown failed: ${message}
- Worker service did not confirm shutdown; continuing uninstal
- Shutdown request returned error
- Shutdown already in progress — ignoring re-entrant shutdown
AI-assisted analysis of thedotmack/claude-mem@8bc631a71a (2026-09-09).
Data as JSON: /api/errors/68edf3d9cb90ebf4.
Report an issue: GitHub.