{"record":{"id":"34787a684644cdd1","repo":"HKUDS/nanobot","slug":"ollama-image-generation-failed-http-response-sta","errorCode":null,"errorMessage":"Ollama image generation failed (HTTP {response.status_code}): {detail}","messagePattern":"Ollama image generation failed \\(HTTP (.+?)\\): (.+?)","errorType":"exception","errorClass":"ImageGenerationError","httpStatus":null,"severity":"error","filePath":"nanobot/providers/image_generation.py","lineNumber":683,"sourceCode":"            \"Content-Type\": \"application/json\",\n            **self.extra_headers,\n        }\n        if self.api_key:\n            headers[\"Authorization\"] = f\"Bearer {self.api_key}\"\n\n        url = f\"{self.api_base}/generate\"\n        response = await self._http_post(url, headers=headers, body=body)\n\n        try:\n            response.raise_for_status()\n        except httpx.HTTPStatusError as exc:\n            detail = _http_error_detail(response)\n            logger.error(\n                \"Ollama image generation failed (HTTP {}): {}\",\n                response.status_code,\n                detail,\n            )\n            raise ImageGenerationError(\n                f\"Ollama image generation failed (HTTP {response.status_code}): {detail}\"\n            ) from exc\n\n        data = response.json()\n        images = _ollama_images_from_payload(data)\n\n        self._require_images(images, data)\n\n        response_text = data.get(\"response\")\n        content = response_text if isinstance(response_text, str) else \"\"\n\n        return GeneratedImageResponse(images=images, content=content, raw=data)\n\n\nclass GeminiImageGenerationClient(ImageGenerationProvider):\n    \"\"\"Async client for Gemini/Imagen image generation via the Generative Language API.\"\"\"\n\n    provider_name = \"gemini\"","sourceCodeStart":665,"sourceCodeEnd":701,"githubUrl":"https://github.com/HKUDS/nanobot/blob/42f37dc4c0e409eac7818a82d165c5f2757bc075/nanobot/providers/image_generation.py#L665-L701","documentation":"Raised by OllamaImageGenerator.generate when the POST to {api_base}/generate returns a non-2xx status. It wraps httpx.HTTPStatusError and includes the status code plus the error body/detail extracted via _http_error_detail, meaning Ollama rejected the image-generation request (bad model, invalid params, server error).","triggerScenarios":"Thrown at nanobot/providers/image_generation.py:683 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the Ollama server is running and reachable at api_base","Verify the requested model is installed (ollama list) and supports image generation","Inspect the detail text for the upstream Ollama error and correct request parameters (prompt, size options)","Retry after fixing the server or request; check extra_headers/api_key if an auth proxy is used"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"42f37dc4c0e409eac7818a82d165c5f2757bc075","analyzedAt":"2026-08-26T00:18:52.276Z","contentChangedAt":"2026-08-26T00:18:52.276Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}