HKUDS/nanobot · error · ImageGenerationError
ModelScope task polling failed
Error message
ModelScope task polling failed: {detail} What it means
Raised in ModelScopeImageGenerator._poll_task when GET {api_base}/tasks/{task_id} returns a non-2xx status while polling the async image task. Wraps httpx.HTTPStatusError with detail, meaning the task endpoint rejected the poll (expired/unknown task id, auth failure, server error).
Solutions
- Verify the task_id and that it has not expired
- Check the ModelScope token remains valid for polling
- Inspect detail for the upstream error; resubmit the generation if the task is gone
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at nanobot/providers/image_generation.py:2078 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/7c32a0e58e97de42.
Report an issue: GitHub.
Appendix: source
Thrown at nanobot/providers/image_generation.py:2078
poll_headers = {
"Authorization": submit_headers["Authorization"],
"X-ModelScope-Task-Type": "image_generation",
**self.extra_headers,
}
poll_url = f"{self.api_base}/tasks/{task_id}"
for _ in range(_MODELSCOPE_POLL_MAX_ATTEMPTS):
try:
response = await client.get(poll_url, headers=poll_headers)
except httpx.RequestError:
await asyncio.sleep(_MODELSCOPE_POLL_INTERVAL_S)
continue
try:
response.raise_for_status()
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"View on GitHub (pinned to 42f37dc4c0)