{"record":{"id":"dff1329b37ee1a10","repo":"zeroclaw-labs/zeroclaw","slug":"ollama-api-error-is-ollama-running-bre","errorCode":null,"errorMessage":"Ollama API error ({}): {}. Is Ollama running? (brew install ollama && ollama serve)","messagePattern":"Ollama API error \\((.+?)\\): (.+?)\\. Is Ollama running\\? \\(brew install ollama && ollama serve\\)","errorType":"http","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/zeroclaw-providers/src/ollama.rs","lineNumber":739,"sourceCode":"        ::zeroclaw_log::record!(\n            DEBUG,\n            ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Note),\n            &format!(\"response body length: {} bytes\", body.len())\n        );\n\n        if !status.is_success() {\n            let raw = String::from_utf8_lossy(&body);\n            let sanitized = super::sanitize_api_error(&raw);\n            ::zeroclaw_log::record!(\n                ERROR,\n                ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Fail)\n                    .with_outcome(::zeroclaw_log::EventOutcome::Failure),\n                &format!(\n                    \"Ollama error response: status={} body_excerpt={}\",\n                    status, sanitized\n                )\n            );\n            anyhow::bail!(\n                \"Ollama API error ({}): {}. Is Ollama running? (brew install ollama && ollama serve)\",\n                status,\n                sanitized\n            );\n        }\n\n        let chat_response: ApiChatResponse = match serde_json::from_slice(&body) {\n            Ok(r) => r,\n            Err(e) => {\n                let raw = String::from_utf8_lossy(&body);\n                let sanitized = super::sanitize_api_error(&raw);\n                ::zeroclaw_log::record!(\n                    ERROR,\n                    ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Fail)\n                        .with_outcome(::zeroclaw_log::EventOutcome::Failure),\n                    &format!(\n                        \"Ollama response deserialization failed: {e}. body_excerpt={}\",\n                        sanitized","sourceCodeStart":721,"sourceCodeEnd":757,"githubUrl":"https://github.com/zeroclaw-labs/zeroclaw/blob/88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc/crates/zeroclaw-providers/src/ollama.rs#L721-L757","documentation":"The ZeroClaw Ollama provider sent a chat request (send_request_inner) and Ollama answered with a non-success HTTP status. The response body is sanitized and embedded in the message; the 'Is Ollama running?' hint covers the case where the configured base_url reaches a service that is not a healthy Ollama instance. Note that a fully-down server normally surfaces earlier as a reqwest connection error through the `?` operator, so this specific error means something did answer, with a 4xx/5xx.","triggerScenarios":"POST to Ollama /api/chat returns non-2xx: 404 'model not found' when the configured model tag was never pulled, 500 on a malformed or oversized request, or a proxy/other process occupying the configured base_url port and returning an error status.","commonSituations":"Model tag typo in config (llama3 vs llama3:8b); forgot `ollama pull` on a fresh machine; ollama serve crashed while base_url still resolves; base_url points at an OpenAI-compatible gateway instead of the native Ollama API; an Ollama version that rejects newer request fields.","solutions":["Confirm Ollama answers: curl http://localhost:11434/api/tags (or your configured base_url + /api/tags).","Match the configured model tag exactly against `ollama list` and run `ollama pull <tag>` for anything missing.","Start or restart the service: `ollama serve` in the foreground, or `brew services start ollama` / systemd unit for persistence.","Verify the ollama provider entry's base_url/endpoint in ZeroClaw config points at the real Ollama port with no proxy in between.","Read the sanitized body excerpt in the zeroclaw WARN log event ('Ollama error response: status=... body_excerpt=...') — it carries Ollama's own error text."],"exampleFix":"# before — tag does not match `ollama list`\n[providers.models.ollama.local]\nmodel = \"llama3\"\n\n# after — exact tag from `ollama list`\n[providers.models.ollama.local]\nmodel = \"llama3:8b\"","handlingStrategy":"try-catch","validationCode":"# Pre-flight before the chat call: Ollama up + model present\ncurl -sf http://localhost:11434/api/tags | jq -e --arg m \"$ZC_OLLAMA_MODEL\" '.models[]?.name == $m' >/dev/null && echo ready","typeGuard":null,"tryCatchPattern":"Match the anyhow error message for the 'Ollama API error (' prefix and parse the embedded status: 5xx → retry with exponential backoff (transient); 404 → fail fast with 'ollama pull <model>' guidance; other 4xx → surface the sanitized body. Always log the sanitized body the provider already attached.","preventionTips":["Run Ollama under a service manager (brew services / systemd) so it auto-restarts","Pull configured model tags at deploy time, not lazily at chat time","Pin exact model tags in config and diff them against `ollama list` in CI","Probe /api/tags in container/orchestrator health checks"],"tags":["ollama","http-status","llm-provider","local-models","network"],"backgroundTag":"llm-api-http-error","analyzedSha":"88bb9c8533fc57ed7a03e36ca7c9ed2bf8336dcc","analyzedAt":"2026-08-23T01:07:41.857Z","schemaVersion":2},"datasetVersion":"2026-08-23T08:06:27.607Z"}