invoke-ai/InvokeAI · error · ExternalProviderRequestError
DashScope task poll failed with status {response.status_code
Error message
DashScope task poll failed with status {response.status_code}: {response.text} What it means
Each poll iteration GETs the DashScope task status URL; if that HTTP request returns non-2xx, _poll_task raises ExternalProviderRequestError with the status code and response body, aborting the wait for the task. Distinct from 624/625 because it happens during polling, after successful submission.
Source
Thrown at invokeai/app/services/external_generation/providers/alibabacloud.py:191
headers: dict[str, str],
task_id: str,
request: ExternalGenerationRequest,
request_id: str | None,
) -> ExternalGenerationResult:
"""Poll an async task until completion."""
task_url = f"{base_url}/api/v1/tasks/{task_id}"
start_time = time.monotonic()
poll_headers = {"Authorization": headers["Authorization"]}
first_poll = True
while True:
elapsed = time.monotonic() - start_time
if elapsed > _TASK_POLL_TIMEOUT:
raise ExternalProviderRequestError(f"DashScope task {task_id} timed out after {_TASK_POLL_TIMEOUT}s")
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)View on GitHub (pinned to 0b6a024f2f)
Solutions
- Check the status code/body in the message to identify the poll failure cause
- Re-check the API key and base_url configuration (401/404 causes)
- Slow down polling or retry the whole generation if throttled (429)
- If 5xx persists, verify DashScope service health and resubmit the task
Defensive patterns
Strategy: try-catch
Validate before calling
if not api_key:
raise ConfigError("DashScope key missing") # 401 during polling otherwise
# and confirm base_url is reachable:
# HEAD base_url before long-running submissions Type guard
def is_poll_http_error(e: Exception) -> bool:
return isinstance(e, ExternalProviderRequestError) and 'task poll failed with status' in str(e) Try / catch
try:
result = provider.generate(request)
except ExternalProviderRequestError as e:
if 'task poll failed' in str(e):
if 'status 401' in str(e):
refresh_key_and_resubmit(request)
elif 'status 429' in str(e):
slow_down_polling(); resubmit(request)
else:
raise Prevention
- Don't rotate/revoke keys while async tasks are in flight
- Keep poll intervals modest to avoid throttling
- Verify base_url region correctness before submitting long tasks
When it happens
Trigger: During polling, the task-status GET returns 4xx/5xx — auth header rejected (401), task URL wrong/expired (404), throttled polls (429), or DashScope errors (5xx).
Common situations: API key rotated/revoked while a task is in flight; base_url misconfiguration producing wrong task URLs; poll interval triggering rate limits; transient DashScope instability mid-poll.
Related errors
- DashScope request failed with status {response.status_code}
- DashScope async request failed with status {response.status_
- 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/4e3a9276feb295e0.
Report an issue: GitHub.