thedotmack/claude-mem · error · HostObserverUnavailableError
No OpenAI-compatible host observer is listening on 127.0.0.1
Error message
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. What it means
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.
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.
Example fix
// before cmem install --provider host # nothing listening // after export CLAUDE_MEM_HOST_OBSERVER_PORT=4141 my-observer --port 4141 & cmem install --provider host
Defensive patterns
Strategy: validation
Validate before calling
for (const p of [4141, 8080, 11434]) {
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 {}
} Try / catch
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; } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.
Related errors
- CLAUDE_MEM_HOST_OBSERVER_PORT=
- classifyClaudeServerError
- classifyGeminiError( )
- classifyGeminiServerError
- classifyHttpProviderError
AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17).
Data as JSON: /api/errors/df91c2983e6189f7.
Report an issue: GitHub.
Appendix: source
Thrown at src/npx-cli/cmem-memory-credentials.ts:264
const status = probe(configured);
if (status === 'observer') return String(configured);
if (status === 'occupied') {
throw new HostObserverUnavailableError(
`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.`,
);
}
throw new HostObserverUnavailableError(
`CLAUDE_MEM_HOST_OBSERVER_PORT=${configured} has nothing listening. Start your OpenAI-compatible observer on that port, then rerun with --provider host.`,
);
}
const candidates = hostObserverCandidatePorts(workerPort, env);
for (const port of candidates) {
const status = probe(port);
if (status === 'observer') return String(port);
}
throw new HostObserverUnavailableError(
`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.`,
);
}
export function buildHostObserverSettings(
observerModel: 'cursor' | 'grok-bot',
settings: SettingsLike,
env: NodeJS.ProcessEnv = process.env,
probe?: HostObserverPortProbe,
): Record<string, string> {
const workerPort = parsePort(settings.CLAUDE_MEM_WORKER_PORT)
?? nonEmptyString(settings.CLAUDE_MEM_WORKER_PORT)
?? undefined;
const port = resolveHostObserverPort(workerPort, env, probe ?? probeHostObserverPortSync);
return {
CLAUDE_MEM_PROVIDER: 'openrouter',
CLAUDE_MEM_OPENROUTER_BASE_URL: `http://127.0.0.1:${port}/v1`,
CLAUDE_MEM_OPENROUTER_MODEL: observerModel,View on GitHub (pinned to d8bc9755e7)