thedotmack/claude-mem · warning

[claude-mem] Worker GET

Error message

[claude-mem] Worker GET ${path} failed: ${message}

What it means

workerGetText catches fetch rejections when GETting the claude-mem worker and logs this warning unless the error is ECONNREFUSED (worker not running, treated as normal). It returns null so callers fall back gracefully.

Solutions

  1. Verify the worker is running and reachable at WORKER_BASE_URL
  2. Check WORKER_BASE_URL scheme (http vs https) matches the worker's listener
  3. Read the logged message for the specific network error and fix accordingly
  4. Confirm DNS/proxy settings in the environment running the plugin

Example fix

// before
const WORKER_BASE_URL = "https://127.0.0.1:37777"; // TLS error: worker is plain HTTP
// after
const WORKER_BASE_URL = "http://127.0.0.1:37777";
Defensive patterns

Strategy: fallback

Validate before calling

try { new URL(`${WORKER_BASE_URL}${path}`); } catch { console.warn('invalid worker URL'); }

Type guard

function isFetchError(e: unknown): e is TypeError {
  return e instanceof TypeError;
}

Try / catch

try {
  const text = await workerGetText(path);
  if (text === null) {
    // fall back to cached/local data
  }
} catch (e) {
  console.warn('worker unreachable', e);
}

Prevention

When it happens

Trigger: The fetch call itself throws with a non-ECONNREFUSED error: DNS resolution failure, TLS handshake error, network timeout/abort, or a malformed URL causing fetch to reject.

Common situations: WORKER_BASE_URL hostname unresolvable; HTTPS configured against an HTTP-only worker (TLS error); transient network drop; firewall blocking the connection in an unexpected way (not plain refusal).

Related errors


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

Appendix: source

Thrown at src/integrations/opencode-plugin/index.ts:143

    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 d8bc9755e7)