{"record":{"id":"8353ecc3725dec49","repo":"santifer/career-ops","slug":"http-probe-status","errorCode":null,"errorMessage":"HTTP ${probe.status}","messagePattern":"HTTP \\$\\{probe\\.status\\}","errorType":"http","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"ollama-eval.mjs","lineNumber":291,"sourceCode":"❌  Remote Ollama endpoint detected: ${baseUrl}\n\n   Your CV and job description would be sent to a remote server.\n   This tool is designed for local use only.\n\n   If you intentionally want to use a remote endpoint (e.g. tunnelled\n   Ollama on a home server), set:\n     OLLAMA_ALLOW_REMOTE=1 node ollama-eval.mjs ...\n`);\n    process.exit(1);\n  }\n}\n\n// ---------------------------------------------------------------------------\n// Check Ollama is reachable before burning time on prompt assembly\n// ---------------------------------------------------------------------------\ntry {\n  const probe = await fetch(`${baseUrl}/api/tags`, { signal: AbortSignal.timeout(5_000) });\n  if (!probe.ok) throw new Error(`HTTP ${probe.status}`);\n} catch (err) {\n  console.error(`\n❌  Ollama not reachable at ${baseUrl}\n\n   1. Install Ollama: https://ollama.com\n   2. Start server:   ollama serve\n   3. Pull a model:   ollama pull ${modelName}\n`);\n  process.exit(1);\n}\n\n// ---------------------------------------------------------------------------\n// Load context files\n// ---------------------------------------------------------------------------\nconsole.log('\\n📂  Loading context files...');\n\nconst sharedContext = readFile(PATHS.shared, 'modes/_shared.md');\nconst ofertaLogic   = readFile(PATHS.oferta, 'modes/oferta.md');","sourceCodeStart":273,"sourceCodeEnd":309,"githubUrl":"https://github.com/santifer/career-ops/blob/aac998c7ed7248ea853b720ceeb1fdbeb322fc5d/ollama-eval.mjs#L273-L309","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run `curl ${baseUrl}/api/tags` and read the status/body to see what is actually answering on that port.","Confirm the real Ollama server is up with `ollama serve` (or `ollama list`) and that baseUrl matches its host/port (default http://localhost:11434).","Check for proxy environment variables (HTTP_PROXY/HTTPS_PROXY/ALL_PROXY) or a system proxy intercepting localhost requests; add baseUrl to NO_PROXY.","Update Ollama — very old builds may not expose /api/tags the same way.","If a proxy in front of Ollama returns 403, fix its allowlist or bypass it for this host."],"exampleFix":"// before\nconst probe = await fetch(`${baseUrl}/api/tags`, { signal: AbortSignal.timeout(5_000) });\nif (!probe.ok) throw new Error(`HTTP ${probe.status}`);\n// after\nconst probe = await fetch(`${baseUrl}/api/tags`, {\n  signal: AbortSignal.timeout(5_000),\n  headers: { 'Accept': 'application/json' },\n});\nif (!probe.ok) {\n  const body = await probe.text().catch(() => '');\n  throw new Error(`HTTP ${probe.status} from ${baseUrl}/api/tags — ${body.slice(0, 200)}`);\n}","handlingStrategy":"validation","validationCode":"async function assertOllamaUp(baseUrl) {\n  const r = await fetch(`${baseUrl}/api/tags`, { signal: AbortSignal.timeout(5000) });\n  if (!r.ok) throw new Error(`Ollama health check failed: HTTP ${r.status} at ${baseUrl}`);\n  await r.json();\n}","typeGuard":null,"tryCatchPattern":"try {\n  await assertOllamaUp(baseUrl);\n} catch (err) {\n  console.error('Ollama unreachable — start it with `ollama serve` and verify OLLAMA_HOST:', err.message);\n  process.exit(1);\n}","preventionTips":["Run `curl http://localhost:11434/api/tags` before long eval runs.","Add baseUrl to NO_PROXY so corporate proxies don't intercept localhost.","Script the `ollama serve` startup as a pre-run dependency check.","Keep Ollama updated so /api/tags stays stable."],"tags":["network","ollama","http-error","health-check"],"backgroundTag":"http-error-response","analyzedSha":"aac998c7ed7248ea853b720ceeb1fdbeb322fc5d","analyzedAt":"2026-09-16T06:35:29.214Z","contentChangedAt":"2026-09-16T06:35:29.214Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}