{"record":{"id":"845ab53d56852636","repo":"thedotmack/claude-mem","slug":"claude-mem-worker-get-path-returned-respons","errorCode":null,"errorMessage":"[claude-mem] Worker GET ${path} returned ${response.status}","messagePattern":"\\[claude-mem\\] Worker GET (.+?) returned (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/integrations/opencode-plugin/index.ts","lineNumber":128,"sourceCode":"  body: Record<string, unknown>,\n): void {\n  fetch(`${WORKER_BASE_URL}${path}`, {\n    method: \"POST\",\n    headers: JSON_HEADERS,\n    body: JSON.stringify(body),\n  }).catch((error: unknown) => {\n    const message = error instanceof Error ? error.message : String(error);\n    if (!message.includes(\"ECONNREFUSED\")) {\n      console.warn(`[claude-mem] Worker POST ${path} failed: ${message}`);\n    }\n  });\n}\n\nasync function workerGetText(path: string): Promise<string | null> {\n  try {\n    const response = await fetch(`${WORKER_BASE_URL}${path}`, { headers: JSON_HEADERS });\n    if (!response.ok) {\n      console.warn(`[claude-mem] Worker GET ${path} returned ${response.status}`);\n      return null;\n    }\n    return await response.text();\n  } catch (error: unknown) {\n    const message = error instanceof Error ? error.message : String(error);\n    if (!message.includes(\"ECONNREFUSED\")) {\n      console.warn(`[claude-mem] Worker GET ${path} failed: ${message}`);\n    }\n    return null;\n  }\n}\n\nconst contentSessionIdsByOpenCodeSessionId = new Map<string, string>();\nconst initializedSessionIds = new Set<string>();\n\nconst MAX_SESSION_MAP_ENTRIES = 1000;\n\nfunction getOrCreateContentSessionId(openCodeSessionId: string): string {","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/e2d1df569a8f04075d40e92461128ece7cf04c82/src/integrations/opencode-plugin/index.ts#L110-L146","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Check ok AND expected routes before trusting worker responses:\nconst res = await fetch(`${WORKER_BASE_URL}${path}`, { headers: JSON_HEADERS });\nif (!res.ok) {\n  if (res.status === 404) {\n    // route missing => plugin/worker version drift; schedule reinstall, skip silently\n  } else {\n    console.warn(`worker ${path} -> ${res.status}: ${await res.text().catch(() => '')}`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try { const r = await fetch(url); if (!r.ok) return fallbackFor(r.status); return await r.text(); }\ncatch (e) { /* transport error — see ECONNREFUSED filtering */ return fallbackFor(0); }","preventionTips":["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."],"tags":["http","worker","status-code","opencode-plugin"],"backgroundTag":"http-error-response","analyzedSha":"e2d1df569a8f04075d40e92461128ece7cf04c82","analyzedAt":"2026-08-20T23:58:13.836Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}