{"record":{"id":"a815eb3fd901880a","repo":"HKUDS/nanobot","slug":"failed-to-download-generated-image-exc","errorCode":null,"errorMessage":"failed to download generated image: {exc}","messagePattern":"failed to download generated image: (.+?)","errorType":"exception","errorClass":"ImageGenerationError","httpStatus":null,"severity":"error","filePath":"nanobot/providers/image_generation.py","lineNumber":228,"sourceCode":"                            pass\n\n                    chunks: list[bytes] = []\n                    total = 0\n                    async for chunk in response.aiter_bytes():\n                        total += len(chunk)\n                        if total > _IMAGE_DOWNLOAD_MAX_BYTES:\n                            raise ImageGenerationError(\n                                \"generated image exceeded the 32 MiB download limit\"\n                            )\n                        chunks.append(chunk)\n                    raw = b\"\".join(chunks)\n                    break\n            else:\n                raise ImageGenerationError(\"generated image URL exceeded the redirect limit\")\n    except UnsafeURLRequestError as exc:\n        raise ImageGenerationError(f\"blocked unsafe generated image URL: {exc}\") from exc\n    except httpx.RequestError as exc:\n        raise ImageGenerationError(f\"failed to download generated image: {exc}\") from exc\n\n    mime = detect_image_mime(raw)\n    if mime is None:\n        raise ImageGenerationError(\"generated image URL did not return a supported image\")\n    encoded = base64.b64encode(raw).decode(\"ascii\")\n    return f\"data:{mime};base64,{encoded}\"\n\n\n# ---------------------------------------------------------------------------\n# Registry\n# ---------------------------------------------------------------------------\n\n_IMAGE_GEN_PROVIDERS: dict[str, type[ImageGenerationProvider]] = {}\n\n\ndef register_image_gen_provider(cls: type[ImageGenerationProvider]) -> None:\n    \"\"\"Register an image provider at import time only.\n","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/HKUDS/nanobot/blob/42f37dc4c0e409eac7818a82d165c5f2757bc075/nanobot/providers/image_generation.py#L210-L246","documentation":"Error \"failed to download generated image: {exc}\" thrown in HKUDS/nanobot.","triggerScenarios":"Thrown at nanobot/providers/image_generation.py:228 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"}