HKUDS/nanobot · error · ImageGenerationError

generated image URL redirected without a location

Error message

generated image URL redirected without a location

What it means

Error "generated image URL redirected without a location" thrown in HKUDS/nanobot.

Source

Thrown at nanobot/providers/image_generation.py:189

            client_kwargs["transport"] = PinnedDNSAsyncTransport(inner=transport)

        async with httpx.AsyncClient(**client_kwargs) as client:
            current_url = url
            for _ in range(_IMAGE_DOWNLOAD_MAX_REDIRECTS + 1):
                if proxy:
                    ok, error, _ = resolve_url_target(
                        current_url,
                        trust_remote_dns=True,
                    )
                    if not ok:
                        raise ImageGenerationError(
                            f"blocked unsafe generated image URL: {error}"
                        )
                async with client.stream("GET", current_url) as response:
                    if response.is_redirect:
                        location = response.headers.get("location")
                        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"

View on GitHub (pinned to 42f37dc4c0)

When it happens

Trigger: Thrown at nanobot/providers/image_generation.py:189 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/1a95406c4a031dad. Report an issue: GitHub.