invoke-ai/InvokeAI · error · ExternalProviderRequestError

DashScope response contained no images: {data}

Error message

DashScope response contained no images: {data}

What it means

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.

Source

Thrown at invokeai/app/services/external_generation/providers/alibabacloud.py:246

        for choice in choices:
            if not isinstance(choice, dict):
                continue
            message = choice.get("message")
            if not isinstance(message, dict):
                continue
            content = message.get("content")
            if not isinstance(content, list):
                continue
            for part in content:
                if not isinstance(part, dict):
                    continue
                image_url = part.get("image")
                if isinstance(image_url, str) and image_url:
                    pil_image = self._download_image(image_url)
                    images.append(ExternalGeneratedImage(image=pil_image, seed=request.seed))

        if not images:
            raise ExternalProviderRequestError(f"DashScope response contained no images: {data}")

        return ExternalGenerationResult(
            images=images,
            seed_used=request.seed,
            provider_request_id=request_id,
            provider_metadata={"model": request.model.provider_model_id},
        )

    def _parse_async_response(
        self,
        output: dict[str, object],
        request: ExternalGenerationRequest,
        request_id: str | None,
    ) -> ExternalGenerationResult:
        """Parse the async task completion response."""
        results = output.get("results")
        if not isinstance(results, list):
            raise ExternalProviderRequestError(f"DashScope async response missing results: {output}")

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Inspect the embedded response data for a text part explaining why no image was returned (e.g. content-policy message)
  2. Adjust the prompt to avoid content-filter triggers and retry
  3. Ensure num_images >= 1 in the ExternalGenerationRequest
  4. Confirm the DashScope response content format still uses {'image': url} parts for this model version
  5. Retry later or with a different model in _SYNC_MODELS

Example fix

# before
content.append({"text": request.prompt})
# after
prompt = request.prompt.strip()
if not prompt:
    raise ExternalProviderRequestError("Prompt is empty; DashScope may return no image")
content.append({"text": prompt})
Defensive patterns

Strategy: try-catch

Validate before calling

def validate_request(req) -> None:
    if not req.prompt or not req.prompt.strip():
        raise ValueError("prompt must be non-empty")
    if req.num_images < 1:
        raise ValueError("num_images must be >= 1")

Type guard

def content_has_image(message: dict) -> bool:
    content = message.get("content")
    return isinstance(content, list) and any(isinstance(p, dict) and p.get("image") for p in content)

Try / catch

try:
    result = provider.generate(request)
except ExternalProviderRequestError as e:
    if "no images" in str(e):
        log.warning("No image in DashScope response; review prompt for content-filter triggers")
    raise

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29). Data as JSON: /api/errors/ddd4efc7715172b7. Report an issue: GitHub.