{"record":{"id":"36c59a4a4a2d13ba","repo":"invoke-ai/InvokeAI","slug":"dashscope-async-response-contained-no-images-out","errorCode":null,"errorMessage":"DashScope async response contained no images: {output}","messagePattern":"DashScope async response contained no images: (.+?)","errorType":"exception","errorClass":"ExternalProviderRequestError","httpStatus":null,"severity":"error","filePath":"invokeai/app/services/external_generation/providers/alibabacloud.py","lineNumber":281,"sourceCode":"        if not isinstance(results, list):\n            raise ExternalProviderRequestError(f\"DashScope async response missing results: {output}\")\n\n        images: list[ExternalGeneratedImage] = []\n        for result in results:\n            if not isinstance(result, dict):\n                continue\n            url = result.get(\"url\")\n            if isinstance(url, str) and url:\n                pil_image = self._download_image(url)\n                images.append(ExternalGeneratedImage(image=pil_image, seed=request.seed))\n                continue\n            b64_image = result.get(\"b64_image\")\n            if isinstance(b64_image, str) and b64_image:\n                pil_image = decode_image_base64(b64_image)\n                images.append(ExternalGeneratedImage(image=pil_image, seed=request.seed))\n\n        if not images:\n            raise ExternalProviderRequestError(f\"DashScope async response contained no images: {output}\")\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 _download_image(self, url: str) -> PILImageType:\n        \"\"\"Download an image from a URL and return it as a PIL Image, with a size cap.\"\"\"\n        try:\n            response = requests.get(url, timeout=_DOWNLOAD_TIMEOUT, stream=True)\n        except requests.RequestException as exc:\n            raise ExternalProviderRequestError(f\"Failed to download image from DashScope: {exc}\") from exc\n\n        with response:\n            if not response.ok:\n                raise ExternalProviderRequestError(","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/services/external_generation/providers/alibabacloud.py#L263-L299","documentation":"The async task reported SUCCEEDED and 'results' was a list, but iterating it produced zero downloadable images: every entry either wasn't a dict, or lacked both a usable 'url' string and 'b64_image' string. The provider raises ExternalProviderRequestError with the output payload.","triggerScenarios":"results entries use a different URL key (e.g. 'image_url' or 'code' with a merged URL); results contain error objects; DashScope returned success with empty results [].","commonSituations":"Custom async models with a result schema unlike wan/wuye image APIs; DashScope partial success returning empty results; region/API revision where result URLs are nested under 'code' instead of 'url'.","solutions":["Inspect the embedded output to see the actual keys in each result entry","If results are empty [], retry the generation — the task 'succeeded' without producing images","Extend/patch _parse_async_response to read alternate keys (e.g. 'image_url', nested 'code') for your custom model","Switch the model to _SYNC_MODELS if it actually supports the synchronous multimodal API","Verify the DashScope region/API version matches the documented async image-generation schema"],"exampleFix":"// before\nurl = result.get(\"url\")\nif isinstance(url, str) and url:\n    ...\n// after\nurl = result.get(\"url\") or result.get(\"image_url\") or result.get(\"code\")\nif isinstance(url, str) and url.startswith(\"http\"):\n    ...","handlingStrategy":"validation","validationCode":"def results_look_valid(output: dict) -> bool:\n    results = output.get(\"results\")\n    return isinstance(results, list) and any(\n        isinstance(r, dict) and (r.get(\"url\") or r.get(\"b64_image\")) for r in results\n    )","typeGuard":"def result_has_image(result: dict) -> bool:\n    return isinstance(result, dict) and (\n        isinstance(result.get(\"url\"), str) and bool(result[\"url\"])\n        or isinstance(result.get(\"b64_image\"), str) and bool(result[\"b64_image\"])\n    )","tryCatchPattern":"try:\n    result = provider.generate(request)\nexcept ExternalProviderRequestError as e:\n    if \"contained no images\" in str(e):\n        log.warning(\"Async task produced zero images; retrying once\")\n        result = provider.generate(request)\n    else:\n        raise","preventionTips":["Retry the generation when a SUCCEEDED task yields empty results","Inspect the result entry keys for custom models and patch the parser accordingly","Confirm the model's documented result schema (url vs b64_image vs code)","Test custom models end-to-end before production use"],"tags":["dashscope","async-task","empty-response","schema-mismatch"],"backgroundTag":"empty-provider-response","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}