invoke-ai/InvokeAI · error · ExternalProviderRequestError

DashScope async request failed with status {response.status_

Error message

DashScope async request failed with status {response.status_code} for model '{model_id}': {response.text}

What it means

In the asynchronous DashScope path, task submission POST must return 2xx; otherwise _generate_async raises ExternalProviderRequestError with the status code and response body before any task_id exists. Same family as error 624 but for the async submit endpoint.

Source

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

            "prompt_extend": False,
            "watermark": False,
        }
        if request.seed is not None:
            parameters["seed"] = request.seed

        input_data: dict[str, object] = {"prompt": request.prompt}

        payload: dict[str, object] = {
            "model": model_id,
            "input": input_data,
            "parameters": parameters,
        }

        response = self._post_with_retry(
            endpoint, headers=async_headers, json=payload, timeout=60, label="DashScope async submit"
        )
        if not response.ok:
            raise ExternalProviderRequestError(
                f"DashScope async request failed with status {response.status_code} for model '{model_id}': {response.text}"
            )

        data = response.json()
        request_id = data.get("request_id")
        output = data.get("output", {})
        task_id = output.get("task_id")

        if not task_id:
            raise ExternalProviderRequestError(f"DashScope async response missing task_id: {data}")

        return self._poll_task(base_url, headers, task_id, request, request_id)

    def _poll_task(
        self,
        base_url: str,
        headers: dict[str, str],
        task_id: str,

View on GitHub (pinned to 0b6a024f2f)

Solutions

  1. Inspect status code and body in the message for DashScope's error code (e.g. AccessDenied, Throttling)
  2. Fix authentication: set a valid external_alibabacloud_api_key
  3. Correct request parameters/size/model id per the async API docs
  4. Retry with backoff on 429/5xx; submission already uses _post_with_retry
Defensive patterns

Strategy: try-catch

Validate before calling

if not api_key:
    raise ConfigError("DashScope key missing")  # avoid guaranteed 401 on async submit
if request.model.provider_model_id not in _ASYNC_MODELS:
    raise ValueError("model is not an async DashScope model")

Type guard

def is_async_submit_error(e: Exception) -> bool:
    return isinstance(e, ExternalProviderRequestError) and 'DashScope async request failed' in str(e)

Try / catch

try:
    result = provider.generate(request)
except ExternalProviderRequestError as e:
    if 'async request failed with status 429' in str(e):
        wait_and_resubmit(request)
    else:
        log.error("DashScope async submit failed: %s", e)
        raise

Prevention

When it happens

Trigger: _generate_async posts the task-creation payload (with async headers) to the DashScope async endpoint and receives a non-2xx response: bad key (401), invalid model or parameters (400), throttling (429), or server error (5xx).

Common situations: Using an async-only model with an invalid key; request payload violating the async API schema; exceeding QPS limits on DashScope; transient DashScope incidents.

Related errors


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