{"record":{"id":"b6f4215b9d6118d0","repo":"thedotmack/claude-mem","slug":"claude-mem-worker-get-path-failed-message","errorCode":null,"errorMessage":"[claude-mem] Worker GET ${path} failed: ${message}","messagePattern":"\\[claude-mem\\] Worker GET (.+?) failed: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/integrations/opencode-plugin/index.ts","lineNumber":135,"sourceCode":"    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 {\n  if (!contentSessionIdsByOpenCodeSessionId.has(openCodeSessionId)) {\n    while (contentSessionIdsByOpenCodeSessionId.size >= MAX_SESSION_MAP_ENTRIES) {\n      const oldestKey = contentSessionIdsByOpenCodeSessionId.keys().next().value;\n      if (oldestKey !== undefined) {\n        contentSessionIdsByOpenCodeSessionId.delete(oldestKey);\n        initializedSessionIds.delete(oldestKey);\n      } else {","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/e2d1df569a8f04075d40e92461128ece7cf04c82/src/integrations/opencode-plugin/index.ts#L117-L153","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// Guard GETs with a timeout so hangs become fast nulls:\nasync function safeGet(path: string): Promise<string | null> {\n  try {\n    const r = await fetch(`${WORKER_BASE_URL}${path}`,\n      { headers: JSON_HEADERS, signal: AbortSignal.timeout(2000) });\n    return r.ok ? await r.text() : null;\n  } catch { return null; } // unreachable/reset worker degrades to 'no data'\n}","typeGuard":null,"tryCatchPattern":"catch (error: unknown) {\n  const message = error instanceof Error ? error.message : String(error);\n  if (!message.includes('ECONNREFUSED')) console.warn(`GET ${path} failed: ${message}`);\n  return null; // caller must tolerate absent data\n}","preventionTips":["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."],"tags":["network","worker","fetch","opencode-plugin"],"backgroundTag":"network-request-failed","analyzedSha":"e2d1df569a8f04075d40e92461128ece7cf04c82","analyzedAt":"2026-08-20T23:58:13.836Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}