ATH-MaaS/Pixelle-Video · error · RuntimeError
Image generation failed: {response.code}, {response.message}
Error message
Image generation failed: {response.code}, {response.message}, status={response.status_code} What it means
When DashScope returns a non-200 status_code, generate_image raises a RuntimeError embedding the provider's error code, message, and HTTP status — the authoritative provider-side failure signal.
Source
Thrown at pixelle_video/services/api_services/image_dashscope.py:131
if response.status_code == 200:
results = self._extract_image_urls(getattr(response, "output", None))
if not results:
raise RuntimeError(f"DashScope image generation returned no image URLs. output={getattr(response, 'output', None)}")
# Check if we should download
if save_dir:
os.makedirs(save_dir, exist_ok=True)
local_files = []
for i, url in enumerate(results):
file_name = f"ds_{session_id if session_id else 'nosess'}_{int(time.time())}_{i}_{uuid.uuid4().hex[:6]}.png"
file_path = os.path.join(save_dir, file_name)
if self.image_processor.download_image(url, file_path):
local_files.append(file_path)
return local_files
return results
else:
raise RuntimeError(f"Image generation failed: {response.code}, {response.message}, status={response.status_code}")
except Exception as e:
logging.error(f"Error in generate_image (DashScope): {e}")
raise
def edit_image(self, prompt, image_urls, model="wan2.7-image", size="1920*1080", n=1, session_id=None, save_dir=None):
"""
Image editing/compositing using DashScope ImageGeneration
"""
if ImageGeneration is None:
raise RuntimeError("dashscope package not installed. Run: pip install dashscope")
# Prepare content
content_list = []
for img_url in image_urls:
content_list.append({"image": img_url})
content_list.append({"text": prompt})
messages = [View on GitHub (pinned to 848b054e4f)
Solutions
- Read response.code/response.message in the error to identify the cause
- Fix credentials or top up quota if 401/quota-related
- Back off and retry on rate-limit codes
- Rephrase the prompt if the code indicates content moderation
Example fix
// before paths = gen.generate_image(prompt=p, model="wan2.7-image", size="9999*1") // after paths = gen.generate_image(prompt=p, model="wan2.7-image", size="1024*1024")
Defensive patterns
Strategy: try-catch
Validate before calling
if response.status_code != 200:
if "Throttling" in str(response.code):
time.sleep(backoff)
elif "InvalidApiKey" in str(response.code):
raise SystemExit("Fix DASHSCOPE_API_KEY") Try / catch
try:
paths = gen.generate_image(prompt=p)
except RuntimeError as e:
if "status=429" in str(e) or "Throttling" in str(e):
time.sleep(5)
paths = gen.generate_image(prompt=p)
else:
raise Prevention
- Map DashScope error codes to retryable vs fatal
- Monitor quota usage proactively
- Pre-screen prompts against content policy
When it happens
Trigger: Any non-200 DashScope response: invalid API key (401), throttling/rate limit, insufficient quota, invalid parameters, model access denied, content policy rejection.
Common situations: Exhausted daily quota; wrong API key for the region/endpoint; unsupported size/model combination; triggering moderation filters with a flagged prompt.
Related errors
- DashScope generation failed: {e}
- DashScope image generation returned no image URLs. output={g
- rsp.code
- DashScope QwenVLClient failed: {getattr(response, 'message',
- str(e)
AI-assisted analysis of ATH-MaaS/Pixelle-Video@848b054e4f (2026-08-30).
Data as JSON: /api/errors/aecbadcac50c5697.
Report an issue: GitHub.