{"record":{"id":"1a95406c4a031dad","repo":"HKUDS/nanobot","slug":"generated-image-url-redirected-without-a-location","errorCode":null,"errorMessage":"generated image URL redirected without a location","messagePattern":"generated image URL redirected without a location","errorType":"exception","errorClass":"ImageGenerationError","httpStatus":null,"severity":"error","filePath":"nanobot/providers/image_generation.py","lineNumber":189,"sourceCode":"            client_kwargs[\"transport\"] = PinnedDNSAsyncTransport(inner=transport)\n\n        async with httpx.AsyncClient(**client_kwargs) as client:\n            current_url = url\n            for _ in range(_IMAGE_DOWNLOAD_MAX_REDIRECTS + 1):\n                if proxy:\n                    ok, error, _ = resolve_url_target(\n                        current_url,\n                        trust_remote_dns=True,\n                    )\n                    if not ok:\n                        raise ImageGenerationError(\n                            f\"blocked unsafe generated image URL: {error}\"\n                        )\n                async with client.stream(\"GET\", current_url) as response:\n                    if response.is_redirect:\n                        location = response.headers.get(\"location\")\n                        if not location:\n                            raise ImageGenerationError(\n                                \"generated image URL redirected without a location\"\n                            )\n                        current_url = urljoin(str(response.url), location)\n                        continue\n\n                    try:\n                        response.raise_for_status()\n                    except httpx.HTTPStatusError as exc:\n                        raise ImageGenerationError(\n                            f\"failed to download generated image (HTTP {response.status_code})\"\n                        ) from exc\n\n                    declared_size = response.headers.get(\"content-length\")\n                    if declared_size:\n                        try:\n                            if int(declared_size) > _IMAGE_DOWNLOAD_MAX_BYTES:\n                                raise ImageGenerationError(\n                                    \"generated image exceeded the 32 MiB download limit\"","sourceCodeStart":171,"sourceCodeEnd":207,"githubUrl":"https://github.com/HKUDS/nanobot/blob/42f37dc4c0e409eac7818a82d165c5f2757bc075/nanobot/providers/image_generation.py#L171-L207","documentation":"Error \"generated image URL redirected without a location\" thrown in HKUDS/nanobot.","triggerScenarios":"Thrown at nanobot/providers/image_generation.py:189 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"}