santifer/career-ops · error · Error

HTTP

Error message

HTTP ${probe.status}

What it means

Thrown by ollama-eval.mjs's pre-flight health probe: before assembling prompts it fetches `${baseUrl}/api/tags` with a 5-second timeout, and if the response is not ok it throws `HTTP <status>`. This is an early-exit guard so the script fails fast with setup instructions instead of wasting time on a run against a dead server. Any non-2xx status (403, 404, 500, etc.) from the local Ollama server produces this error.

Solutions

  1. Run `curl ${baseUrl}/api/tags` and read the status/body to see what is actually answering on that port.
  2. Confirm the real Ollama server is up with `ollama serve` (or `ollama list`) and that baseUrl matches its host/port (default http://localhost:11434).
  3. Check for proxy environment variables (HTTP_PROXY/HTTPS_PROXY/ALL_PROXY) or a system proxy intercepting localhost requests; add baseUrl to NO_PROXY.
  4. Update Ollama — very old builds may not expose /api/tags the same way.
  5. If a proxy in front of Ollama returns 403, fix its allowlist or bypass it for this host.

Example fix

// before
const probe = await fetch(`${baseUrl}/api/tags`, { signal: AbortSignal.timeout(5_000) });
if (!probe.ok) throw new Error(`HTTP ${probe.status}`);
// after
const probe = await fetch(`${baseUrl}/api/tags`, {
  signal: AbortSignal.timeout(5_000),
  headers: { 'Accept': 'application/json' },
});
if (!probe.ok) {
  const body = await probe.text().catch(() => '');
  throw new Error(`HTTP ${probe.status} from ${baseUrl}/api/tags — ${body.slice(0, 200)}`);
}
Defensive patterns

Strategy: validation

Validate before calling

async function assertOllamaUp(baseUrl) {
  const r = await fetch(`${baseUrl}/api/tags`, { signal: AbortSignal.timeout(5000) });
  if (!r.ok) throw new Error(`Ollama health check failed: HTTP ${r.status} at ${baseUrl}`);
  await r.json();
}

Try / catch

try {
  await assertOllamaUp(baseUrl);
} catch (err) {
  console.error('Ollama unreachable — start it with `ollama serve` and verify OLLAMA_HOST:', err.message);
  process.exit(1);
}

Prevention

When it happens

Trigger: Calling the eval entrypoint when Ollama responds to GET /api/tags with a non-ok HTTP status: server mid-restart, a reverse proxy intercepting the port, wrong port mapping, or an incompatible Ollama build exposing a different API path.

Common situations: Ollama running behind a proxy that returns 403/502; `OLLAMA_HOST`/baseUrl pointing at a port served by another process that returns 404 for /api/tags; a Docker port-forward to a stopped container; corporate proxy injecting 407 responses.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16). Data as JSON: /api/errors/8353ecc3725dec49. Report an issue: GitHub.

Appendix: source

Thrown at ollama-eval.mjs:291

❌  Remote Ollama endpoint detected: ${baseUrl}

   Your CV and job description would be sent to a remote server.
   This tool is designed for local use only.

   If you intentionally want to use a remote endpoint (e.g. tunnelled
   Ollama on a home server), set:
     OLLAMA_ALLOW_REMOTE=1 node ollama-eval.mjs ...
`);
    process.exit(1);
  }
}

// ---------------------------------------------------------------------------
// Check Ollama is reachable before burning time on prompt assembly
// ---------------------------------------------------------------------------
try {
  const probe = await fetch(`${baseUrl}/api/tags`, { signal: AbortSignal.timeout(5_000) });
  if (!probe.ok) throw new Error(`HTTP ${probe.status}`);
} catch (err) {
  console.error(`
❌  Ollama not reachable at ${baseUrl}

   1. Install Ollama: https://ollama.com
   2. Start server:   ollama serve
   3. Pull a model:   ollama pull ${modelName}
`);
  process.exit(1);
}

// ---------------------------------------------------------------------------
// Load context files
// ---------------------------------------------------------------------------
console.log('\n📂  Loading context files...');

const sharedContext = readFile(PATHS.shared, 'modes/_shared.md');
const ofertaLogic   = readFile(PATHS.oferta, 'modes/oferta.md');

View on GitHub (pinned to aac998c7ed)