{"record":{"id":"e6947f4b586b9e03","repo":"thedotmack/claude-mem","slug":"claude-mem-host-observer-port-configured-has-no","errorCode":null,"errorMessage":"CLAUDE_MEM_HOST_OBSERVER_PORT=${configured} has nothing listening. Start your OpenAI-compatible observer on that port, then rerun with --provider host.","messagePattern":"CLAUDE_MEM_HOST_OBSERVER_PORT=(.+?) has nothing listening\\. Start your OpenAI-compatible observer on that port, then rerun with --provider host\\.","errorType":"exception","errorClass":"HostObserverUnavailableError","httpStatus":null,"severity":"error","filePath":"src/npx-cli/cmem-memory-credentials.ts","lineNumber":253,"sourceCode":"    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);\n    if (status === 'observer') return String(port);\n  }\n\n  throw new HostObserverUnavailableError(\n    `No OpenAI-compatible host observer is listening on 127.0.0.1:${candidates.join(' or ') || HOST_OBSERVER_DEFAULT_PORT}. Host mode uses an observer you already run; claude-mem does not start one. Start your observer, then rerun with --provider host. If it uses another port, set CLAUDE_MEM_HOST_OBSERVER_PORT.`,\n  );\n}\n\nexport function buildHostObserverSettings(\n  observerModel: 'cursor' | 'grok-bot',\n  settings: SettingsLike,","sourceCodeStart":235,"sourceCodeEnd":271,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/npx-cli/cmem-memory-credentials.ts#L235-L271","documentation":"If CLAUDE_MEM_HOST_OBSERVER_PORT is set but nothing at all is listening on that port, resolveHostObserverPort throws HostObserverUnavailableError telling you to start the observer first. Host mode never launches a server for you — it only connects to one you run yourself.","triggerScenarios":"CLAUDE_MEM_HOST_OBSERVER_PORT names a valid, non-worker port, but probe(configured) finds no listener ('nothing listening').","commonSituations":"Observer process not started yet, crashed, or exited; wrong port typed in the env var; observer bound on a different machine/interface while the env var implies localhost.","solutions":["Start your OpenAI-compatible observer so it listens on the configured port.","Confirm the port with `curl http://127.0.0.1:<port>/v1/models` and fix CLAUDE_MEM_HOST_OBSERVER_PORT if it points at the wrong port.","Rerun with --provider host once the observer is up."],"exampleFix":"# before\nexport CLAUDE_MEM_HOST_OBSERVER_PORT=4141  # observer not running\ncmem memory --provider host  # throws\n// after\nmy-observer --port 4141 &\ncmem memory --provider host","handlingStrategy":"retry","validationCode":"const port = Number(process.env.CLAUDE_MEM_HOST_OBSERVER_PORT);\nif (port) { try { const r = await fetch(`http://127.0.0.1:${port}/v1/models`); if (!r.ok) throw new Error('not OpenAI-compatible'); } catch { console.error(`nothing healthy on ${port}; start your observer first`); process.exit(1); } }","typeGuard":null,"tryCatchPattern":"try { resolveHostObserverPort(workerPort); } catch (e) { if (e instanceof HostObserverUnavailableError && /nothing listening/.test(e.message)) { await startObserver(); /* then retry once */ } else throw e; }","preventionTips":["Run the observer as a managed service (systemd/launchd) so it is always up","Health-check the observer port before invoking cmem commands","Pin the correct port in one place, e.g. an .env file sourced by your shell"],"tags":["network","ports","host-observer"],"backgroundTag":"connection-refused","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"}