HKUDS/nanobot · error · ImageGenerationError
OpenRouter image generation failed: {detail}
Error message
OpenRouter image generation failed: {detail} What it means
Error "OpenRouter image generation failed: {detail}" thrown in HKUDS/nanobot.
Source
Thrown at nanobot/providers/image_generation.py:424
image_config["image_size"] = image_size
if image_config:
body["image_config"] = image_config
body.update(self.extra_body)
headers = {
"Authorization": f"Bearer {self.api_key}",
"Content-Type": "application/json",
**_OPENROUTER_ATTRIBUTION_HEADERS,
**self.extra_headers,
}
url = f"{self.api_base}/chat/completions"
response = await self._http_post(url, headers=headers, body=body)
try:
response.raise_for_status()
except httpx.HTTPStatusError as exc:
detail = response.text[:500]
raise ImageGenerationError(f"OpenRouter image generation failed: {detail}") from exc
data = _as_json_object(response.json()) or {}
images: list[str] = []
text_parts: list[str] = []
for choice in _as_json_objects(data.get("choices")):
message = _as_json_object(choice.get("message")) or {}
message_content = message.get("content")
if isinstance(message_content, str):
text_parts.append(message_content)
for image in _as_json_objects(message.get("images")):
image_url = _as_json_object(image.get("image_url") or image.get("imageUrl"))
url_value = image_url.get("url") if image_url is not None else None
if isinstance(url_value, str) and url_value.startswith("data:image/"):
images.append(url_value)
self._require_images(images, data)
return GeneratedImageResponse(View on GitHub (pinned to 42f37dc4c0)
When it happens
Trigger: Thrown at nanobot/providers/image_generation.py:424 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of HKUDS/nanobot@42f37dc4c0 (2026-08-26).
Data as JSON: /api/errors/25de5959ac4240e6.
Report an issue: GitHub.