{"record":{"id":"6c9eeb1667c1e14f","repo":"thedotmack/claude-mem","slug":"claude-mem-host-observer-port-configured-is-the","errorCode":null,"errorMessage":"CLAUDE_MEM_HOST_OBSERVER_PORT=${configured} is the claude-mem worker port. Point it at your OpenAI-compatible observer instead.","messagePattern":"CLAUDE_MEM_HOST_OBSERVER_PORT=(.+?) is the claude-mem worker port\\. Point it at your OpenAI-compatible observer instead\\.","errorType":"exception","errorClass":"HostObserverUnavailableError","httpStatus":null,"severity":"error","filePath":"src/npx-cli/cmem-memory-credentials.ts","lineNumber":242,"sourceCode":"\n/** Atomically move staged/current credentials into the active provider slot. */\n\nexport function resolveHostObserverPort(\n  workerPort: string | number | undefined,\n  env: NodeJS.ProcessEnv = process.env,\n  probe: HostObserverPortProbe = probeHostObserverPortSync,\n): string {\n  const worker = parsePort(typeof workerPort === 'number' ? workerPort : nonEmptyString(workerPort));\n  const configuredRaw = nonEmptyString(env.CLAUDE_MEM_HOST_OBSERVER_PORT);\n  if (configuredRaw) {\n    const configured = parsePort(configuredRaw);\n    if (configured == null) {\n      throw new HostObserverUnavailableError(\n        `CLAUDE_MEM_HOST_OBSERVER_PORT=${configuredRaw} is not a valid port. Set it to the port your OpenAI-compatible observer already listens on.`,\n      );\n    }\n    if (worker != null && configured === worker) {\n      throw new HostObserverUnavailableError(\n        `CLAUDE_MEM_HOST_OBSERVER_PORT=${configured} is the claude-mem worker port. Point it at your OpenAI-compatible observer instead.`,\n      );\n    }\n    const status = probe(configured);\n    if (status === 'observer') return String(configured);\n    if (status === 'occupied') {\n      throw new HostObserverUnavailableError(\n        `CLAUDE_MEM_HOST_OBSERVER_PORT=${configured} is occupied by a process that is not an OpenAI-compatible observer. Stop that process or point CLAUDE_MEM_HOST_OBSERVER_PORT at your observer.`,\n      );\n    }\n    throw new HostObserverUnavailableError(\n      `CLAUDE_MEM_HOST_OBSERVER_PORT=${configured} has nothing listening. Start your OpenAI-compatible observer on that port, then rerun with --provider host.`,\n    );\n  }\n\n  const candidates = hostObserverCandidatePorts(workerPort, env);\n  for (const port of candidates) {\n    const status = probe(port);","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/npx-cli/cmem-memory-credentials.ts#L224-L260","documentation":"claude-mem runs its own background worker on a port (CLAUDE_MEM_WORKER_PORT). In host observer mode, the configured CLAUDE_MEM_HOST_OBSERVER_PORT must point at your external OpenAI-compatible observer, not at claude-mem's own worker. resolveHostObserverPort throws when the two ports are identical to prevent routing memory traffic into the worker as if it were the observer.","triggerScenarios":"CLAUDE_MEM_HOST_OBSERVER_PORT equals the worker port (workerPort argument, derived from CLAUDE_MEM_WORKER_PORT), e.g. both set to 37777 while using --provider host.","commonSituations":"Users copying the worker port into the observer variable assuming they are the same service; copy-paste config where one port number was reused for everything.","solutions":["Point CLAUDE_MEM_HOST_OBSERVER_PORT at the port of your actual OpenAI-compatible observer (Cursor/Grok bot endpoint port), distinct from the worker port.","Or unset CLAUDE_MEM_HOST_OBSERVER_PORT and let claude-mem auto-discover the observer on its candidate ports.","If you intended to use claude-mem's built-in model, drop --provider host instead of pointing host mode at the worker."],"exampleFix":"// before\nexport CLAUDE_MEM_WORKER_PORT=37777\nexport CLAUDE_MEM_HOST_OBSERVER_PORT=37777\n// after\nexport CLAUDE_MEM_WORKER_PORT=37777\nexport CLAUDE_MEM_HOST_OBSERVER_PORT=4141","handlingStrategy":"validation","validationCode":"const w = Number(process.env.CLAUDE_MEM_WORKER_PORT), h = Number(process.env.CLAUDE_MEM_HOST_OBSERVER_PORT);\nif (w && h && w === h) throw new Error('observer port must differ from worker port');","typeGuard":null,"tryCatchPattern":"try { buildHostObserverSettings(model, settings); } catch (e) { if (e instanceof HostObserverUnavailableError && /worker port/.test(e.message)) { console.error('Set CLAUDE_MEM_HOST_OBSERVER_PORT to your external observer, not the worker'); } else throw e; }","preventionTips":["Never reuse the worker port number for other services in config","Document distinct ports for worker vs observer in your setup notes","Read the error text: it names the exact conflicting variable"],"tags":["configuration","port-conflict","host-observer"],"backgroundTag":"conflicting-config-options","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"}