HKUDS/nanobot · error · ImageGenerationError
failed to download generated image
Error message
failed to download generated image (HTTP {response.status_code}) What it means
Error wrapping in _download_image_data_url: raise_for_status failed on the image GET, meaning the host returned an HTTP error (404 expired URL, 403 denied, 5xx). The original HTTPStatusError is re-raised as ImageGenerationError with the status code embedded.
Solutions
- Retry the generation — image URLs are often short-lived and may have expired
- Use the image data immediately after generation instead of deferring the download
- Check the status code: 403 suggests auth/ACL issues on the host, 5xx a provider-side problem
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at nanobot/providers/image_generation.py:206 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/f0c5eda6224e0821.
Report an issue: GitHub.
Appendix: source
Thrown at nanobot/providers/image_generation.py:206
if not location:
raise ImageGenerationError(
"generated image URL redirected without a location"
)
current_url = urljoin(str(response.url), location)
continue
try:
response.raise_for_status()
except httpx.HTTPStatusError as exc:
raise ImageGenerationError(
f"failed to download generated image (HTTP {response.status_code})"
) from exc
declared_size = response.headers.get("content-length")
if declared_size:
try:
if int(declared_size) > _IMAGE_DOWNLOAD_MAX_BYTES:
raise ImageGenerationError(
"generated image exceeded the 32 MiB download limit"
)
except ValueError:
pass
chunks: list[bytes] = []
total = 0
async for chunk in response.aiter_bytes():
total += len(chunk)
if total > _IMAGE_DOWNLOAD_MAX_BYTES:
raise ImageGenerationError(
"generated image exceeded the 32 MiB download limit"
)
chunks.append(chunk)
raw = b"".join(chunks)
break
else:
raise ImageGenerationError("generated image URL exceeded the redirect limit")View on GitHub (pinned to 42f37dc4c0)