invoke-ai/InvokeAI · error · ExternalProviderRequestError
DashScope task {task_id} failed: {message}
Error message
DashScope task {task_id} failed: {message} What it means
When the polled DashScope task reaches terminal status FAILED or UNKNOWN, _poll_task raises ExternalProviderRequestError embedding the task id and DashScope's output.message (or 'Unknown error'). The HTTP machinery worked; the generation itself failed on the provider side.
Source
Thrown at invokeai/app/services/external_generation/providers/alibabacloud.py:207
response = self._get_with_retry(task_url, headers=poll_headers, timeout=30, label="DashScope task poll")
if not response.ok:
raise ExternalProviderRequestError(
f"DashScope task poll failed with status {response.status_code}: {response.text}"
)
data = response.json()
output = data.get("output", {})
status = output.get("task_status")
if first_poll:
self._logger.info("DashScope task %s submitted (status=%s)", task_id, status)
first_poll = False
if status == "SUCCEEDED":
return self._parse_async_response(output, request, request_id)
if status in ("FAILED", "UNKNOWN"):
message = output.get("message", "Unknown error")
raise ExternalProviderRequestError(f"DashScope task {task_id} failed: {message}")
self._logger.debug("DashScope task %s status: %s (%.0fs elapsed)", task_id, status, elapsed)
time.sleep(_TASK_POLL_INTERVAL)
def _parse_sync_response(
self,
data: dict[str, object],
request: ExternalGenerationRequest,
request_id: str | None,
) -> ExternalGenerationResult:
"""Parse the synchronous multimodal-generation response."""
output = data.get("output")
if not isinstance(output, dict):
raise ExternalProviderRequestError(f"DashScope response missing output: {data}")
choices = output.get("choices")
if not isinstance(choices, list):
raise ExternalProviderRequestError(f"DashScope response missing choices: {data}")View on GitHub (pinned to 0b6a024f2f)
Solutions
- Read output.message in the error text — DashScope's message states the failure reason (e.g. content policy, invalid parameter)
- Adjust the prompt to avoid content-moderation rejections and resubmit
- Validate parameters (size, model-specific options) against the model's constraints and retry
- If UNKNOWN or repeated internal errors, retry later or contact Alibaba Cloud support with the task_id
Defensive patterns
Strategy: fallback
Validate before calling
# screen prompts client-side before submission to reduce content-policy failures
if contains_flagged_terms(request.prompt):
raise ValueError("prompt likely rejected by DashScope moderation") Try / catch
try:
result = provider.generate(request)
except ExternalProviderRequestError as e:
if 'failed:' in str(e) and 'DashScope task' in str(e):
log.warning("DashScope task failed: %s", e)
result = fallback_provider.generate(request) # or retry once with sanitized prompt
else:
raise Prevention
- Read the embedded output.message to classify the failure before retrying
- Sanitize/adjust prompts to pass content moderation
- Validate model-specific parameters (size, seed) before submission
- Configure a fallback provider for non-transient task failures
When it happens
Trigger: Poll loop observes output.task_status == 'FAILED' or 'UNKNOWN'; message comes from output.get('message'). Common underlying causes are content-policy rejections, invalid generation parameters accepted at submit time but failing at execution, or provider internal errors.
Common situations: Prompt flagged by DashScope content moderation; image size/seed parameters invalid for the model at run time; provider internal errors during rendering; UNKNOWN status from malformed task state after an incident.
Related errors
- DashScope async request failed with status {response.status_
- DashScope async response missing task_id: {data}
- DashScope task {task_id} timed out after {_TASK_POLL_TIMEOUT
- Alibaba Cloud DashScope API key is not configured
- Unknown DashScope model_id '{model_id}'. Add it to _SYNC_MOD
AI-assisted analysis of invoke-ai/InvokeAI@0b6a024f2f (2026-08-29).
Data as JSON: /api/errors/edd6ab28dd24d6b3.
Report an issue: GitHub.