{"record":{"id":"ddd4efc7715172b7","repo":"invoke-ai/InvokeAI","slug":"dashscope-response-contained-no-images-data","errorCode":null,"errorMessage":"DashScope response contained no images: {data}","messagePattern":"DashScope response contained no images: (.+?)","errorType":"exception","errorClass":"ExternalProviderRequestError","httpStatus":null,"severity":"error","filePath":"invokeai/app/services/external_generation/providers/alibabacloud.py","lineNumber":246,"sourceCode":"        for choice in choices:\n            if not isinstance(choice, dict):\n                continue\n            message = choice.get(\"message\")\n            if not isinstance(message, dict):\n                continue\n            content = message.get(\"content\")\n            if not isinstance(content, list):\n                continue\n            for part in content:\n                if not isinstance(part, dict):\n                    continue\n                image_url = part.get(\"image\")\n                if isinstance(image_url, str) and image_url:\n                    pil_image = self._download_image(image_url)\n                    images.append(ExternalGeneratedImage(image=pil_image, seed=request.seed))\n\n        if not images:\n            raise ExternalProviderRequestError(f\"DashScope response contained no images: {data}\")\n\n        return ExternalGenerationResult(\n            images=images,\n            seed_used=request.seed,\n            provider_request_id=request_id,\n            provider_metadata={\"model\": request.model.provider_model_id},\n        )\n\n    def _parse_async_response(\n        self,\n        output: dict[str, object],\n        request: ExternalGenerationRequest,\n        request_id: str | None,\n    ) -> ExternalGenerationResult:\n        \"\"\"Parse the async task completion response.\"\"\"\n        results = output.get(\"results\")\n        if not isinstance(results, list):\n            raise ExternalProviderRequestError(f\"DashScope async response missing results: {output}\")","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/services/external_generation/providers/alibabacloud.py#L228-L264","documentation":"The sync response parsed structurally correctly (output.choices present) but no image parts were found while walking choices -> message -> content -> {image: url}. DashScope replied without any generated image, so the provider raises ExternalProviderRequestError with the full response data.","triggerScenarios":"Choices contain only text parts (no {'image': url} entries); n=0 honored by the API; content filter stripped the image; message/content shape changed (e.g. content is a string instead of a list, so iteration yields nothing).","commonSituations":"Prompt rejected or partially filtered by DashScope; model returns text-only explanation instead of an image; num_images=0 requested upstream; DashScope silently degrading under capacity pressure.","solutions":["Inspect the embedded response data for a text part explaining why no image was returned (e.g. content-policy message)","Adjust the prompt to avoid content-filter triggers and retry","Ensure num_images >= 1 in the ExternalGenerationRequest","Confirm the DashScope response content format still uses {'image': url} parts for this model version","Retry later or with a different model in _SYNC_MODELS"],"exampleFix":"# before\ncontent.append({\"text\": request.prompt})\n# after\nprompt = request.prompt.strip()\nif not prompt:\n    raise ExternalProviderRequestError(\"Prompt is empty; DashScope may return no image\")\ncontent.append({\"text\": prompt})","handlingStrategy":"try-catch","validationCode":"def validate_request(req) -> None:\n    if not req.prompt or not req.prompt.strip():\n        raise ValueError(\"prompt must be non-empty\")\n    if req.num_images < 1:\n        raise ValueError(\"num_images must be >= 1\")","typeGuard":"def content_has_image(message: dict) -> bool:\n    content = message.get(\"content\")\n    return isinstance(content, list) and any(isinstance(p, dict) and p.get(\"image\") for p in content)","tryCatchPattern":"try:\n    result = provider.generate(request)\nexcept ExternalProviderRequestError as e:\n    if \"no images\" in str(e):\n        log.warning(\"No image in DashScope response; review prompt for content-filter triggers\")\n    raise","preventionTips":["Avoid prompt terms likely to trip DashScope content moderation","Always request num_images >= 1","Log the raw response data in the error to find text explanations","Retry once before surfacing the failure to users"],"tags":["dashscope","empty-response","content-filter","image-generation"],"backgroundTag":"empty-provider-response","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}