{"record":{"id":"64f6c1da43fd8247","repo":"HKUDS/nanobot","slug":"modelscope-image-generation-task-failed-data","errorCode":null,"errorMessage":"ModelScope image generation task failed: {data}","messagePattern":"ModelScope image generation task failed: (.+?)","errorType":"exception","errorClass":"ImageGenerationError","httpStatus":null,"severity":"error","filePath":"nanobot/providers/image_generation.py","lineNumber":2088,"sourceCode":"            except httpx.RequestError:\n                await asyncio.sleep(_MODELSCOPE_POLL_INTERVAL_S)\n                continue\n\n            try:\n                response.raise_for_status()\n            except httpx.HTTPStatusError as exc:\n                detail = _http_error_detail(response)\n                raise ImageGenerationError(\n                    f\"ModelScope task polling failed: {detail}\"\n                ) from exc\n\n            data = response.json()\n            status = data.get(\"task_status\")\n\n            if status == \"SUCCEED\":\n                return await self._collect_images(data)\n            if status == \"FAILED\":\n                raise ImageGenerationError(\n                    f\"ModelScope image generation task failed: {data}\"\n                )\n\n            await asyncio.sleep(_MODELSCOPE_POLL_INTERVAL_S)\n\n        raise ImageGenerationError(\n            f\"ModelScope image generation timed out after \"\n            f\"{_MODELSCOPE_POLL_MAX_ATTEMPTS} polls\"\n        )\n\n    async def _collect_images(\n        self,\n        data: dict[str, Any],\n    ) -> list[str]:\n        images: list[str] = []\n        for url in cast(list[object], data.get(\"output_images\") or []):\n            if isinstance(url, str) and url:\n                if url.startswith(\"data:image/\"):","sourceCodeStart":2070,"sourceCodeEnd":2106,"githubUrl":"https://github.com/HKUDS/nanobot/blob/42f37dc4c0e409eac7818a82d165c5f2757bc075/nanobot/providers/image_generation.py#L2070-L2106","documentation":"Raised in ModelScopeImageGenerator._poll_task when the polled task reports task_status == 'FAILED'. The full task JSON is embedded in the message; this is ModelScope reporting the generation itself failed (e.g. content policy or internal error), not a transport problem.","triggerScenarios":"Thrown at nanobot/providers/image_generation.py:2088 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the embedded task data for the failure reason","Adjust the prompt if it violated content policy","Resubmit the generation request"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"42f37dc4c0e409eac7818a82d165c5f2757bc075","analyzedAt":"2026-08-26T00:18:52.276Z","contentChangedAt":"2026-08-26T00:18:52.276Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}