ATH-MaaS/Pixelle-Video · error · RuntimeError

DashScope {action_name} failed after {max_attempts} attempts

Error message

DashScope {action_name} failed after {max_attempts} attempts due to network error: {last_error}

What it means

DashScope video calls are wrapped by _with_network_retry, which retries transient network errors up to max_attempts with backoff. If every attempt fails (connection resets, timeouts, DNS issues), it raises RuntimeError chaining the last exception. It indicates persistent network problems reaching the DashScope endpoint, not an API rejection.

Source

Thrown at pixelle_video/services/api_services/video_dashscope.py:107

            except Exception as exc:
                if not self._is_retryable_error(exc):
                    raise
                last_error = exc

            if attempt >= max_attempts:
                break
            delay = min(base_delay * attempt, 20)
            logger.warning(
                "DashscopeVideoClient: %s network error, retrying %s/%s in %.1fs: %s",
                action_name,
                attempt,
                max_attempts,
                delay,
                last_error,
            )
            time.sleep(delay)

        raise RuntimeError(
            f"DashScope {action_name} failed after {max_attempts} attempts due to network error: {last_error}"
        ) from last_error

    def _is_retryable_error(self, exc: Exception) -> bool:
        message = str(exc).lower()
        retry_markers = (
            "ssleoferror",
            "unexpected_eof",
            "eof occurred in violation of protocol",
            "connection reset",
            "connection aborted",
            "remote disconnected",
            "max retries exceeded",
            "read timed out",
            "connect timed out",
            "temporarily unavailable",
        )
        return any(marker in message for marker in retry_markers)

View on GitHub (pinned to 848b054e4f)

Solutions

  1. Check basic connectivity: curl https://dashscope.aliyuncs.com from the host running the code
  2. Increase max_attempts and/or backoff delay in _with_network_retry for flaky networks
  3. Fix proxy settings (HTTP_PROXY/HTTPS_PROXY/NO_PROXY) so requests can reach the endpoint
  4. Inspect the chained last_error (cause) for the root cause (timeout vs DNS vs TLS)
  5. Check Alibaba Cloud status page for regional incidents

Example fix

// before
result = client.generate_video(prompt)  # RuntimeError after N attempts
// after
import requests
try:
    result = client.generate_video(prompt)
except RuntimeError as e:
    logging.error(f"DashScope retries exhausted: {e}", exc_info=e.__cause__)
    result = None  # queue for later re-run / alert ops
Defensive patterns

Strategy: retry

Validate before calling

import requests
requests.head('https://dashscope.aliyuncs.com', timeout=5)  # verify reachability before long jobs

Try / catch

try:
    video = client.generate_video(prompt)
except RuntimeError as e:
    logging.error('DashScope retries exhausted', exc_info=e.__cause__)
    schedule_retry_later(task)  # requeue with backoff / alert

Prevention

When it happens

Trigger: generate_video -> _with_network_retry where _is_retryable_error matched (e.g. ConnectionError, timeout) and all max_attempts attempts failed; proxy/firewall blocking the endpoint; prolonged network outage during the retry window.

Common situations: Corporate proxy or firewall blocking dashscope.aliyuncs.com; DNS failures in containers; unstable VPN; transient cloud-region outage longer than the retry budget.

Related errors


AI-assisted analysis of ATH-MaaS/Pixelle-Video@848b054e4f (2026-08-30). Data as JSON: /api/errors/32f1422cd69bd602. Report an issue: GitHub.