{"record":{"id":"25de5959ac4240e6","repo":"HKUDS/nanobot","slug":"openrouter-image-generation-failed-detail","errorCode":null,"errorMessage":"OpenRouter image generation failed: {detail}","messagePattern":"OpenRouter image generation failed: (.+?)","errorType":"exception","errorClass":"ImageGenerationError","httpStatus":null,"severity":"error","filePath":"nanobot/providers/image_generation.py","lineNumber":424,"sourceCode":"            image_config[\"image_size\"] = image_size\n        if image_config:\n            body[\"image_config\"] = image_config\n        body.update(self.extra_body)\n\n        headers = {\n            \"Authorization\": f\"Bearer {self.api_key}\",\n            \"Content-Type\": \"application/json\",\n            **_OPENROUTER_ATTRIBUTION_HEADERS,\n            **self.extra_headers,\n        }\n        url = f\"{self.api_base}/chat/completions\"\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 = response.text[:500]\n            raise ImageGenerationError(f\"OpenRouter image generation failed: {detail}\") from exc\n\n        data = _as_json_object(response.json()) or {}\n        images: list[str] = []\n        text_parts: list[str] = []\n        for choice in _as_json_objects(data.get(\"choices\")):\n            message = _as_json_object(choice.get(\"message\")) or {}\n            message_content = message.get(\"content\")\n            if isinstance(message_content, str):\n                text_parts.append(message_content)\n            for image in _as_json_objects(message.get(\"images\")):\n                image_url = _as_json_object(image.get(\"image_url\") or image.get(\"imageUrl\"))\n                url_value = image_url.get(\"url\") if image_url is not None else None\n                if isinstance(url_value, str) and url_value.startswith(\"data:image/\"):\n                    images.append(url_value)\n\n        self._require_images(images, data)\n\n        return GeneratedImageResponse(","sourceCodeStart":406,"sourceCodeEnd":442,"githubUrl":"https://github.com/HKUDS/nanobot/blob/42f37dc4c0e409eac7818a82d165c5f2757bc075/nanobot/providers/image_generation.py#L406-L442","documentation":"Error \"OpenRouter image generation failed: {detail}\" thrown in HKUDS/nanobot.","triggerScenarios":"Thrown at nanobot/providers/image_generation.py:424 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"42f37dc4c0e409eac7818a82d165c5f2757bc075","analyzedAt":"2026-08-26T00:18:52.276Z","schemaVersion":2},"datasetVersion":"2026-08-26T04:18:47.238Z"}