thedotmack/claude-mem · warning
[claude-mem] Worker GET ${path} returned ${response.status}
Error message
[claude-mem] Worker GET ${path} returned ${response.status} What it means
workerGetText() performs a GET against the local claude-mem worker and logs this warning whenever the HTTP response status is not 2xx, returning null. Unlike the connection-refused case (suppressed), this means the worker IS reachable but rejected or failed the request — 404 for a route the worker version does not expose, 500 for an in-worker error, 413 for an oversized payload.
Source
Thrown at src/integrations/opencode-plugin/index.ts:128
body: Record<string, unknown>,
): void {
fetch(`${WORKER_BASE_URL}${path}`, {
method: "POST",
headers: JSON_HEADERS,
body: JSON.stringify(body),
}).catch((error: unknown) => {
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 {View on GitHub (pinned to e2d1df569a)
Solutions
- Reproduce manually: `curl -i http://127.0.0.1:$CLAUDE_MEM_WORKER_PORT/<same-path>` to see the exact status and body.
- Version-align plugin and worker: reinstall with `npx claude-mem install` so both come from the same release, then restart OpenCode.
- For 500s, check worker logs (its stdout/journal) for the stack trace of the failing route handler.
- If a 404 comes from a foreign process on the port, free the port or change CLAUDE_MEM_WORKER_PORT in settings.json and restart both worker and OpenCode.
Defensive patterns
Strategy: validation
Validate before calling
// Check ok AND expected routes before trusting worker responses:
const res = await fetch(`${WORKER_BASE_URL}${path}`, { headers: JSON_HEADERS });
if (!res.ok) {
if (res.status === 404) {
// route missing => plugin/worker version drift; schedule reinstall, skip silently
} else {
console.warn(`worker ${path} -> ${res.status}: ${await res.text().catch(() => '')}`);
}
} Try / catch
try { const r = await fetch(url); if (!r.ok) return fallbackFor(r.status); return await r.text(); }
catch (e) { /* transport error — see ECONNREFUSED filtering */ return fallbackFor(0); } Prevention
- Always branch on response.status, not just response.ok — 404 vs 500 need different remediation.
- Version-lock the plugin and worker by installing both from the same release.
- Smoke-test worker routes after upgrades: curl each endpoint the integration uses.
- Log the response body on non-2xx — worker error payloads usually carry the reason.
When it happens
Trigger: GET to a worker endpoint (e.g. session-mapping or status routes) that returns 404 because the installed worker is older/newer than the plugin and the route moved; 4xx/5xx from a worker bug or a proxy occupying CLAUDE_MEM_WORKER_PORT answering with its own error pages.
Common situations: Plugin and worker versions drift after a partial upgrade (`npm update` moved the plugin but the daemon still runs the old build); a dev proxy or other service squatting on the worker port; worker crashed on a previous malformed request and now 500s.
Understand the failure class
Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.
Related errors
- Worker API error (${response.status}): ${errorText}
- http_error
- sync hub status ${response.status}: ${body}
- Shutdown request returned error
- [claude-mem] Worker POST ${path} failed: ${message}
AI-assisted analysis of thedotmack/claude-mem@e2d1df569a (2026-08-20).
Data as JSON: /api/errors/845ab53d56852636.
Report an issue: GitHub.