{"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/8bc631a71a487424b866756e43a6efa4574cc66b/src/npx-cli/cmem-memory-credentials.ts#L246-L282","documentation":"When CLAUDE_MEM_HOST_OBSERVER_PORT is unset, host mode auto-discovers by probing 127.0.0.1:37777 then 37778 (skipping the worker port). If neither serves an OpenAI-compatible endpoint, the install fails with this error, because host mode explicitly never starts an observer itself — you must already run one.","triggerScenarios":"Running `npx claude-mem install --provider host` with no CLAUDE_MEM_HOST_OBSERVER_PORT env var while nothing OpenAI-compatible is listening on the candidate ports (37777/37778).","commonSituations":"First-time host-mode setup where the user assumed claude-mem would launch an observer; observer running on a non-default port; observer crashed since a previous successful install.","solutions":["Start your OpenAI-compatible observer (the default candidates are 37777 or 37778) and rerun with --provider host","If your observer uses another port, set CLAUDE_MEM_HOST_OBSERVER_PORT to it: export CLAUDE_MEM_HOST_OBSERVER_PORT=4141","Confirm with curl http://127.0.0.1:37777/v1/models (and 37778) whether anything is reachable","Pick a different provider (e.g. --provider claude) if you do not intend to run a host observer"],"exampleFix":"// before\nnpx claude-mem install --provider host   # nothing on 37777/37778\n// after\nexport CLAUDE_MEM_HOST_OBSERVER_PORT=4141  # where your observer listens\nnpx claude-mem install --provider host","handlingStrategy":"retry","validationCode":"for (const p of [37777, 37778]) {\n  const ok = await fetch(`http://127.0.0.1:${p}/v1/models`).then(r => r.ok).catch(() => false);\n  if (ok) { process.env.CLAUDE_MEM_HOST_OBSERVER_PORT = String(p); break; }\n}","typeGuard":null,"tryCatchPattern":"try {\n  const port = resolveHostObserverPort(workerPort, env);\n} catch (e) {\n  if (e instanceof HostObserverUnavailableError && e.message.startsWith('No OpenAI-compatible host observer')) {\n    // start observer, optionally set CLAUDE_MEM_HOST_OBSERVER_PORT, and retry\n  } else throw e;\n}","preventionTips":["Run your observer on the default ports 37777/37778 so auto-discovery finds it","If it uses another port, always set CLAUDE_MEM_HOST_OBSERVER_PORT explicitly","Remember host mode never starts an observer — provision one yourself before install"],"tags":["network","host-observer","discovery","connection"],"backgroundTag":"connection-refused","analyzedSha":"8bc631a71a487424b866756e43a6efa4574cc66b","analyzedAt":"2026-09-09T10:47:06.009Z","contentChangedAt":"2026-09-09T10:47:06.009Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}