thedotmack/claude-mem · warning
[claude-mem] Worker GET ${path} failed: ${message}
Error message
[claude-mem] Worker GET ${path} failed: ${message} What it means
workerGetText() wraps its fetch in try/catch; this warning fires when the GET itself throws with any error other than ECONNREFUSED (worker simply not running — suppressed as a normal state). It means a transport-level failure: connection reset, timeout, DNS failure on a custom CLAUDE_MEM_WORKER_HOST, or an invalid URL built from settings. The function returns null, so callers degrade to 'no data' rather than crashing.
Source
Thrown at src/integrations/opencode-plugin/index.ts:135
const message = error instanceof Error ? error.message : String(error);
if (!message.includes("ECONNREFUSED")) {
console.warn(`[claude-mem] Worker POST ${path} failed: ${message}`);
}
});
}
async function workerGetText(path: string): Promise<string | null> {
try {
const response = await fetch(`${WORKER_BASE_URL}${path}`, { headers: JSON_HEADERS });
if (!response.ok) {
console.warn(`[claude-mem] Worker GET ${path} returned ${response.status}`);
return null;
}
return await response.text();
} catch (error: unknown) {
const message = error instanceof Error ? error.message : String(error);
if (!message.includes("ECONNREFUSED")) {
console.warn(`[claude-mem] Worker GET ${path} failed: ${message}`);
}
return null;
}
}
const contentSessionIdsByOpenCodeSessionId = new Map<string, string>();
const initializedSessionIds = new Set<string>();
const MAX_SESSION_MAP_ENTRIES = 1000;
function getOrCreateContentSessionId(openCodeSessionId: string): string {
if (!contentSessionIdsByOpenCodeSessionId.has(openCodeSessionId)) {
while (contentSessionIdsByOpenCodeSessionId.size >= MAX_SESSION_MAP_ENTRIES) {
const oldestKey = contentSessionIdsByOpenCodeSessionId.keys().next().value;
if (oldestKey !== undefined) {
contentSessionIdsByOpenCodeSessionId.delete(oldestKey);
initializedSessionIds.delete(oldestKey);
} else {View on GitHub (pinned to e2d1df569a)
Solutions
- Restart the worker and retry (`npx claude-mem worker` or the installed service unit).
- Check CLAUDE_MEM_WORKER_HOST/CLAUDE_MEM_WORKER_PORT resolve and listen as expected: `curl -i http://<host>:<port>/`.
- Restart OpenCode after any worker host/port change so the plugin recomputes WORKER_BASE_URL.
- For repeated resets, check worker logs for crashes (OOM, unhandled rejection) and update claude-mem to the latest patch release.
Defensive patterns
Strategy: fallback
Validate before calling
// Guard GETs with a timeout so hangs become fast nulls:
async function safeGet(path: string): Promise<string | null> {
try {
const r = await fetch(`${WORKER_BASE_URL}${path}`,
{ headers: JSON_HEADERS, signal: AbortSignal.timeout(2000) });
return r.ok ? await r.text() : null;
} catch { return null; } // unreachable/reset worker degrades to 'no data'
} Try / catch
catch (error: unknown) {
const message = error instanceof Error ? error.message : String(error);
if (!message.includes('ECONNREFUSED')) console.warn(`GET ${path} failed: ${message}`);
return null; // caller must tolerate absent data
} Prevention
- Treat worker data as optional enrichment, never as a hard dependency in plugin hooks.
- Set explicit fetch timeouts (AbortSignal.timeout) — reset connections otherwise hang the hook.
- Restart OpenCode after worker host/port changes so module-load constants re-resolve.
- Monitor worker liveness with a periodic health check and restart it on crash.
When it happens
Trigger: Worker killed between TCP accept and response (ECONNRESET); CLAUDE_MEM_WORKER_HOST set to an unresolvable hostname; worker port occupied by a process that accepts then drops connections; WORKER_BASE_URL resolved at module load pointing at a stale port after settings changed.
Common situations: Worker daemon auto-updated or restarted while a long-lived OpenCode session keeps calling it; host/port settings edited without restarting OpenCode; containerized setups where the worker hostname is only resolvable inside a network the plugin later left.
Related errors
- [claude-mem] Worker POST ${path} failed: ${message}
- Server ${method} ${path} failed: ${message}
- [claude-mem] Worker GET ${path} returned ${response.status}
- `server ${commandLabel}` is a server runtime command, but CL
- Worker API error (${response.status}): ${errorText}
AI-assisted analysis of thedotmack/claude-mem@e2d1df569a (2026-08-20).
Data as JSON: /api/errors/b6f4215b9d6118d0.
Report an issue: GitHub.