HKUDS/nanobot · error · ImageGenerationError

returned no images

Error message

{label} returned no images: {provider_error}

What it means

Shared result guard _require_images: a provider response yielded an empty image list AND the payload contained an error field. The provider explicitly reported a failure alongside no images; the error text is surfaced verbatim via {provider_error} prefixed with the provider name.

Solutions

  1. Follow the embedded provider error (usually auth, quota, or content-policy rejection)
  2. Retry if the error indicates a transient condition
  3. Adjust prompt/parameters if the error flags a policy violation
Defensive patterns

Strategy: try-catch

When it happens

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

Appendix: source

Thrown at nanobot/providers/image_generation.py:334

    @abstractmethod
    async def generate(
        self,
        *,
        prompt: str,
        model: str,
        reference_images: list[str] | None = None,
        aspect_ratio: str | None = None,
        image_size: str | None = None,
    ) -> GeneratedImageResponse: ...

    def _require_images(self, images: list[str], data: dict[str, Any]) -> None:
        if images:
            return
        provider_error = data.get("error")
        label = self.provider_name
        if provider_error:
            raise ImageGenerationError(f"{label} returned no images: {provider_error}")
        raise ImageGenerationError(f"{label} returned no images for this request")

    def _http_client_kwargs(self) -> dict[str, Any]:
        kwargs: dict[str, Any] = {"timeout": self.timeout}
        if self.proxy:
            kwargs["proxy"] = self.proxy
            kwargs["trust_env"] = False
        return kwargs

    async def _http_post(
        self,
        url: str,
        *,
        headers: dict[str, str],
        body: dict[str, Any],
        client: httpx.AsyncClient | None = None,
    ) -> httpx.Response:
        if client is not None:

View on GitHub (pinned to 42f37dc4c0)