HKUDS/nanobot · error · ImageGenerationError
Codex image generation failed
Error message
Codex image generation failed (HTTP {response.status_code}): {detail} What it means
Raised in the Codex image generator's generate when POST {api_base}/codex/responses returns a non-2xx status. Wraps httpx.HTTPStatusError with status code and up to 1000 chars of body, meaning the Codex Responses API rejected the image-generation request (auth, model support, or invalid request fields).
Solutions
- Verify Codex OAuth/authentication is valid and not expired
- Confirm the model supports image generation via the Responses API
- Inspect the detail body for the rejected field and adjust body/extra_body
- Retry after fixing configuration
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at nanobot/providers/image_generation.py:1467 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/eaaf2c0b658d91e4.
Report an issue: GitHub.
Appendix: source
Thrown at nanobot/providers/image_generation.py:1467
"store": False,
}
body.update(self.extra_body)
logger.info("Codex Responses API request: POST {}/codex/responses body={}",
self.api_base, {k: v for k, v in body.items() if k != "input"})
response = await self._http_post(
f"{self.api_base}/codex/responses",
headers=headers,
body=body,
)
try:
response.raise_for_status()
except httpx.HTTPStatusError as exc:
detail = response.text[:1000]
logger.error("Codex Responses API error ({}): {}", response.status_code, detail)
raise ImageGenerationError(
f"Codex image generation failed (HTTP {response.status_code}): {detail}"
) from exc
images, content_text = await _parse_codex_sse_images(response)
raw = {"status": "completed"}
self._require_images(images, raw)
return GeneratedImageResponse(images=images, content=content_text, raw=raw)
def _openai_size(
model: str,
aspect_ratio: str | None,
image_size: str | None,
) -> str:
"""Resolve aspect ratio or image_size to an OpenAI Images API size string."""
sizes, supported_sizes = _openai_size_options(model)View on GitHub (pinned to 42f37dc4c0)