HKUDS/DeepTutor · error · GenerationProviderError

Image provider returned no images.

Error message

Image provider returned no images.

What it means

The /images/generations call succeeded but the materialized images list is empty. Since _extract_items would have raised on a missing data array, this means items existed but every _materialize call produced nothing — practically it guards against an empty-after-filtering result (e.g. data array items that were non-dict were dropped).

Source

Thrown at deeptutor/services/imagegen/adapters/openai_compat.py:67

        if config.style:
            payload["style"] = config.style
        if config.response_format:
            payload["response_format"] = config.response_format

        logger.debug(
            "imagegen url=%s model=%s n=%d size=%s", url, config.model, max(1, n), config.size
        )
        try:
            async with httpx.AsyncClient(timeout=config.request_timeout) as client:
                resp = await client.post(url, headers=headers, json=payload)
                raise_for_provider(resp, "Image generation")
                images = [
                    await self._materialize(client, item) for item in self._extract_items(resp)
                ]
        except httpx.HTTPError as exc:
            raise GenerationProviderError(f"Image generation request error: {exc}") from exc
        if not images:
            raise GenerationProviderError("Image provider returned no images.")
        return images

    @staticmethod
    def _extract_items(resp: httpx.Response) -> list[dict[str, Any]]:
        data = resp.json()
        if isinstance(data, dict):
            items = data.get("data")
            if isinstance(items, list) and items:
                return [item for item in items if isinstance(item, dict)]
        raise GenerationProviderError("Image response had no `data` array.")

    async def _materialize(
        self, client: httpx.AsyncClient, item: dict[str, Any]
    ) -> tuple[bytes, str]:
        b64 = item.get("b64_json")
        if isinstance(b64, str) and b64:
            return base64.b64decode(b64), "image/png"
        src = item.get("url")

View on GitHub (pinned to 3e82f13042)

Solutions

  1. Log the raw response JSON to see what data actually contained
  2. If the provider is non-conforming, use the adapter/provider matching its schema or fix the gateway
  3. Retry once — some gateways emit degenerate bodies under load
Defensive patterns

Strategy: try-catch

Try / catch

try:
    images = await adapter.generate(prompt, config)
except GenerationProviderError as exc:
    if "no images" in str(exc):
        logger.error("degenerate response body: %s", raw_body)
        raise

Prevention

When it happens

Trigger: A response whose data array contains only non-dict entries (all filtered out by the isinstance check in _extract_items), yielding zero items to materialize.

Common situations: Non-conforming provider returning strings or nulls in data; partial provider outages returning degenerate responses.

Related errors


AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27). Data as JSON: /api/errors/0e5e06b754210bc8. Report an issue: GitHub.