thedotmack/claude-mem · error · HostObserverUnavailableError
CLAUDE_MEM_HOST_OBSERVER_PORT=
Error message
CLAUDE_MEM_HOST_OBSERVER_PORT=${configured} is the claude-mem worker port. Point it at your OpenAI-compatible observer instead. What it means
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.
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.
Example fix
// before export CLAUDE_MEM_WORKER_PORT=37777 export CLAUDE_MEM_HOST_OBSERVER_PORT=37777 // after export CLAUDE_MEM_WORKER_PORT=37777 export CLAUDE_MEM_HOST_OBSERVER_PORT=4141
Defensive patterns
Strategy: validation
Validate before calling
const w = Number(process.env.CLAUDE_MEM_WORKER_PORT), h = Number(process.env.CLAUDE_MEM_HOST_OBSERVER_PORT);
if (w && h && w === h) throw new Error('observer port must differ from worker port'); Try / catch
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; } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- CLAUDE_MEM_HOST_OBSERVER_PORT=
- Anthropic API rejected request with HTTP 400: this model…
- auth_invalid
- auth_invalid
- Cannot bootstrap server API key…
AI-assisted analysis of thedotmack/claude-mem@d8bc9755e7 (2026-09-17).
Data as JSON: /api/errors/6c9eeb1667c1e14f.
Report an issue: GitHub.
Appendix: source
Thrown at src/npx-cli/cmem-memory-credentials.ts:242
/** Atomically move staged/current credentials into the active provider slot. */
export function resolveHostObserverPort(
workerPort: string | number | undefined,
env: NodeJS.ProcessEnv = process.env,
probe: HostObserverPortProbe = probeHostObserverPortSync,
): string {
const worker = parsePort(typeof workerPort === 'number' ? workerPort : nonEmptyString(workerPort));
const configuredRaw = nonEmptyString(env.CLAUDE_MEM_HOST_OBSERVER_PORT);
if (configuredRaw) {
const configured = parsePort(configuredRaw);
if (configured == null) {
throw new HostObserverUnavailableError(
`CLAUDE_MEM_HOST_OBSERVER_PORT=${configuredRaw} is not a valid port. Set it to the port your OpenAI-compatible observer already listens on.`,
);
}
if (worker != null && configured === worker) {
throw new HostObserverUnavailableError(
`CLAUDE_MEM_HOST_OBSERVER_PORT=${configured} is the claude-mem worker port. Point it at your OpenAI-compatible observer instead.`,
);
}
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);View on GitHub (pinned to d8bc9755e7)