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

  1. Restart the worker and retry (`npx claude-mem worker` or the installed service unit).
  2. Check CLAUDE_MEM_WORKER_HOST/CLAUDE_MEM_WORKER_PORT resolve and listen as expected: `curl -i http://<host>:<port>/`.
  3. Restart OpenCode after any worker host/port change so the plugin recomputes WORKER_BASE_URL.
  4. 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

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


AI-assisted analysis of thedotmack/claude-mem@e2d1df569a (2026-08-20). Data as JSON: /api/errors/b6f4215b9d6118d0. Report an issue: GitHub.