{"record":{"id":"6f9edd27d0eb07db","repo":"thedotmack/claude-mem","slug":"claude-mem-worker-post-path-failed-message","errorCode":null,"errorMessage":"[claude-mem] Worker POST ${path} failed: ${message}","messagePattern":"\\[claude-mem\\] Worker POST (.+?) failed: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/integrations/opencode-plugin/index.ts","lineNumber":127,"sourceCode":"const MAX_TOOL_RESPONSE_LENGTH = 1000;\n\nconst JSON_HEADERS: Record<string, string> = { \"Content-Type\": \"application/json\" };\n\nfunction workerPostFireAndForget(\n  path: string,\n  body: Record<string, unknown>,\n): void {\n  fetch(`${WORKER_BASE_URL}${path}`, {\n    method: \"POST\",\n    headers: JSON_HEADERS,\n    body: JSON.stringify({\n      ...body,\n      platformSource: normalizePlatformSource(\"opencode\"),\n    }),\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;","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/integrations/opencode-plugin/index.ts#L109-L145","documentation":"workerPostFireAndForget sends fire-and-forget POSTs to the claude-mem worker; if the fetch rejects, it logs this warning unless the error is ECONNREFUSED (worker simply not running). It surfaces network/protocol failures on worker communication.","triggerScenarios":"The fetch to `${WORKER_BASE_URL}${path}` rejects with a non-ECONNREFUSED error: DNS failure, TLS error, request aborted, invalid URL, or an unexpected TypeError from fetch.","commonSituations":"Worker URL misconfigured (wrong port/host); worker crashed mid-request; proxy/firewall interfering; WORKER_BASE_URL malformed so fetch throws immediately.","solutions":["Start the claude-mem worker and verify it is listening at WORKER_BASE_URL","Check WORKER_BASE_URL for typos in host/port","Test connectivity: curl the worker endpoint path directly","Inspect the logged message for the underlying cause (DNS vs TLS vs abort)"],"exampleFix":"// before\nconst WORKER_BASE_URL = \"http://localhost:wrong-port\";\n// after\nconst WORKER_BASE_URL = \"http://127.0.0.1:37777\"; // match worker config","handlingStrategy":"retry","validationCode":"const url = new URL(`${WORKER_BASE_URL}${path}`);\nawait fetch(url, { method: 'HEAD' }).then(r => { if (!r.ok) console.warn('worker unhealthy:', r.status); });","typeGuard":"function isNetworkError(e: unknown): e is TypeError {\n  return e instanceof TypeError; // fetch rejects with TypeError on network failure\n}","tryCatchPattern":"try {\n  await fetch(url, { method: 'POST', body });\n} catch (e) {\n  if (!(e instanceof Error && e.message.includes('ECONNREFUSED'))) {\n    console.warn('worker POST failed', e);\n    // queue for retry\n  }\n}","preventionTips":["Health-check the worker before sending data","Validate WORKER_BASE_URL at startup","Use fire-and-forget semantics with a retry queue"],"tags":["http","worker","network","fetch"],"backgroundTag":"http-request-failed","analyzedSha":"d8bc9755e74915e5c3b999181e10a67c889bce2a","analyzedAt":"2026-09-17T16:40:26.182Z","contentChangedAt":"2026-09-17T16:40:26.182Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}