ATH-MaaS/Pixelle-Video · error · RuntimeError

DashScope generation failed: {e}

Error message

DashScope generation failed: {e}

What it means

generate_image wraps the DashScope image generation call: any exception from the DashScope SDK is logged and re-raised as RuntimeError('DashScope generation failed: {e}') with the original attached as __cause__.

Source

Thrown at pixelle_video/services/api_services/image_client.py:274

                        save_dir=save_dir
                    )
                else:
                    # Text to Image
                    # Assuming default size 1024*1024 or similar
                    paths = self.dashscope_client.generate_image(
                        prompt=prompt,
                        model=model,
                        size=size,
                        session_id=session_id,
                        save_dir=save_dir
                    )
                
                if paths:
                    generated_local_paths.extend(paths)
                            
            except Exception as e:
                logging.error(f"DashScope generation failed: {e}")
                raise RuntimeError(f"DashScope generation failed: {e}") from e

        return generated_local_paths

View on GitHub (pinned to 848b054e4f)

Solutions

  1. Inspect the chained cause (__cause__) for the underlying SDK error
  2. Verify DASHSCOPE_API_KEY validity and account quota
  3. Confirm the model name and size string match DashScope's supported values
  4. Retry with backoff for transient network errors

Example fix

// before
try:
    paths = gen.generate_image(prompt=p)
except Exception:
    pass
// after
try:
    paths = gen.generate_image(prompt=p)
except RuntimeError as e:
    logging.error("cause=%s", e.__cause__)
    paths = fallback_provider.generate_image(prompt=p)
Defensive patterns

Strategy: try-catch

Validate before calling

import os
assert os.environ.get("DASHSCOPE_API_KEY"), "DASHSCOPE_API_KEY required"
assert model in SUPPORTED_DASHSCOPE_MODELS

Try / catch

try:
    paths = gen.generate_image(prompt=p)
except RuntimeError as e:
    logging.error("dashscope failed: %s; cause: %s", e, e.__cause__)
    paths = fallback.generate_image(prompt=p)

Prevention

When it happens

Trigger: Any failure inside the DashScope ImageGeneration call: invalid API key, quota exceeded, network timeout, invalid model/size parameters, malformed prompt, or SDK-level errors.

Common situations: Expired or wrong DashScope API key; requesting a size unsupported by the model; regional network issues reaching DashScope; model name typo (e.g. wan2.7-image not enabled for the account).

Related errors


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