HKUDS/nanobot · error · ImageGenerationError

ModelScope image generation timed out after

Error message

ModelScope image generation timed out after {_MODELSCOPE_POLL_MAX_ATTEMPTS} polls

What it means

Raised in ModelScopeImageGenerator._poll_task when the task neither SUCCEEDs nor FAILs within _MODELSCOPE_POLL_MAX_ATTEMPTS polls (with _MODELSCOPE_POLL_INTERVAL_S sleeps). The async task stayed pending too long, so the client gives up rather than polling indefinitely.

Solutions

  1. Retry the generation; the task may still complete server-side
  2. Increase _MODELSCOPE_POLL_MAX_ATTEMPTS or the poll interval if long queues are expected
  3. Check ModelScope service status for degraded task throughput
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at nanobot/providers/image_generation.py:2094 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of HKUDS/nanobot@42f37dc4c0 (2026-08-26). Data as JSON: /api/errors/7c27e92d85c9d37e. Report an issue: GitHub.

Appendix: source

Thrown at nanobot/providers/image_generation.py:2094

            except httpx.HTTPStatusError as exc:
                detail = _http_error_detail(response)
                raise ImageGenerationError(
                    f"ModelScope task polling failed: {detail}"
                ) from exc

            data = response.json()
            status = data.get("task_status")

            if status == "SUCCEED":
                return await self._collect_images(data)
            if status == "FAILED":
                raise ImageGenerationError(
                    f"ModelScope image generation task failed: {data}"
                )

            await asyncio.sleep(_MODELSCOPE_POLL_INTERVAL_S)

        raise ImageGenerationError(
            f"ModelScope image generation timed out after "
            f"{_MODELSCOPE_POLL_MAX_ATTEMPTS} polls"
        )

    async def _collect_images(
        self,
        data: dict[str, Any],
    ) -> list[str]:
        images: list[str] = []
        for url in cast(list[object], data.get("output_images") or []):
            if isinstance(url, str) and url:
                if url.startswith("data:image/"):
                    images.append(url)
                else:
                    images.append(
                        await _download_image_data_url(url, proxy=self.proxy)
                    )
        return images

View on GitHub (pinned to 42f37dc4c0)