{"record":{"id":"df91c2983e6189f7","repo":"thedotmack/claude-mem","slug":"no-openai-compatible-host-observer-is-listening-on","errorCode":null,"errorMessage":"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.","messagePattern":"No OpenAI-compatible host observer is listening on 127\\.0\\.0\\.1:(.+?)\\. 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\\.","errorType":"exception","errorClass":"HostObserverUnavailableError","httpStatus":null,"severity":"error","filePath":"src/npx-cli/cmem-memory-credentials.ts","lineNumber":264,"sourceCode":"    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,\n  env: NodeJS.ProcessEnv = process.env,\n  probe?: HostObserverPortProbe,\n): Record<string, string> {\n  const workerPort = parsePort(settings.CLAUDE_MEM_WORKER_PORT)\n    ?? nonEmptyString(settings.CLAUDE_MEM_WORKER_PORT)\n    ?? undefined;\n  const port = resolveHostObserverPort(workerPort, env, probe ?? probeHostObserverPortSync);\n  return {\n    CLAUDE_MEM_PROVIDER: 'openrouter',\n    CLAUDE_MEM_OPENROUTER_BASE_URL: `http://127.0.0.1:${port}/v1`,\n    CLAUDE_MEM_OPENROUTER_MODEL: observerModel,","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/npx-cli/cmem-memory-credentials.ts#L246-L282","documentation":"When no explicit CLAUDE_MEM_HOST_OBSERVER_PORT is set, claude-mem probes a list of candidate ports on 127.0.0.1 looking for an OpenAI-compatible observer. If none of the candidates respond as an observer, it throws this error clarifying that host mode expects you to run the observer yourself — claude-mem will not start one.","triggerScenarios":"Invoking install/memory with --provider host (or buildHostObserverSettings) without CLAUDE_MEM_HOST_OBSERVER_PORT while no candidate port (defaults plus CLAUDE_MEM_HOST_OBSERVER-related hints) hosts an observer.","commonSituations":"User selects host provider but never installed/started the observer tool (Cursor, Grok bot); observer running on a nonstandard port outside the candidate list; observer bound to a non-loopback interface only.","solutions":["Start your OpenAI-compatible observer and make sure it listens on 127.0.0.1.","If it uses a nonstandard port, set CLAUDE_MEM_HOST_OBSERVER_PORT to that port and rerun.","Verify with `curl http://127.0.0.1:<port>/v1/models` that an OpenAI-compatible endpoint answers.","If you don't actually run an observer, choose a different provider instead of --provider host."],"exampleFix":"// before\ncmem install --provider host  # nothing listening\n// after\nexport CLAUDE_MEM_HOST_OBSERVER_PORT=4141\nmy-observer --port 4141 &\ncmem install --provider host","handlingStrategy":"validation","validationCode":"for (const p of [4141, 8080, 11434]) {\n  try { const r = await fetch(`http://127.0.0.1:${p}/v1/models`); if (r.ok) { process.env.CLAUDE_MEM_HOST_OBSERVER_PORT = String(p); break; } } catch {}\n}","typeGuard":null,"tryCatchPattern":"try { const port = resolveHostObserverPort(workerPort); } catch (e) { if (e instanceof HostObserverUnavailableError && /No OpenAI-compatible host observer/.test(e.message)) { console.error('Start your observer or set CLAUDE_MEM_HOST_OBSERVER_PORT'); } else throw e; }","preventionTips":["Always run the observer before selecting --provider host","Bind the observer to 127.0.0.1 explicitly","Set CLAUDE_MEM_HOST_OBSERVER_PORT explicitly instead of relying on discovery"],"tags":["network","host-observer","discovery"],"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"}