{"record":{"id":"04d4d3e2147c1a6f","repo":"HKUDS/nanobot","slug":"modelscope-did-not-return-a-task-id-response-tex","errorCode":null,"errorMessage":"ModelScope did not return a task_id: {response.text[:500]}","messagePattern":"ModelScope did not return a task_id: (.+?)","errorType":"exception","errorClass":"ImageGenerationError","httpStatus":null,"severity":"error","filePath":"nanobot/providers/image_generation.py","lineNumber":2045,"sourceCode":"        body: dict[str, Any],\n    ) -> GeneratedImageResponse:\n        try:\n            response = await client.post(url, headers=headers, json=body)\n        except httpx.TimeoutException as exc:\n            raise ImageGenerationError(\"ModelScope image generation request timed out\") from exc\n        except httpx.RequestError as exc:\n            raise ImageGenerationError(f\"ModelScope image generation request failed: {exc}\") from exc\n\n        try:\n            response.raise_for_status()\n        except httpx.HTTPStatusError as exc:\n            detail = _http_error_detail(response)\n            raise ImageGenerationError(f\"ModelScope image generation failed: {detail}\") from exc\n\n        task_data = response.json()\n        task_id = task_data.get(\"task_id\")\n        if not task_id:\n            raise ImageGenerationError(\n                f\"ModelScope did not return a task_id: {response.text[:500]}\"\n            )\n\n        images = await self._poll_task(client, task_id, headers)\n\n        self._require_images(images, task_data)\n        return GeneratedImageResponse(images=images, content=\"\", raw=task_data)\n\n    async def _poll_task(\n        self,\n        client: httpx.AsyncClient,\n        task_id: str,\n        submit_headers: dict[str, str],\n    ) -> list[str]:\n        poll_headers = {\n            \"Authorization\": submit_headers[\"Authorization\"],\n            \"X-ModelScope-Task-Type\": \"image_generation\",\n            **self.extra_headers,","sourceCodeStart":2027,"sourceCodeEnd":2063,"githubUrl":"https://github.com/HKUDS/nanobot/blob/42f37dc4c0e409eac7818a82d165c5f2757bc075/nanobot/providers/image_generation.py#L2027-L2063","documentation":"Error \"ModelScope did not return a task_id: {response.text[:500]}\" thrown in HKUDS/nanobot.","triggerScenarios":"Thrown at nanobot/providers/image_generation.py:2045 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"42f37dc4c0e409eac7818a82d165c5f2757bc075","analyzedAt":"2026-08-26T00:18:52.276Z","schemaVersion":2},"datasetVersion":"2026-08-26T04:18:47.238Z"}