ATH-MaaS/Pixelle-Video · error · RuntimeError

DashScope image generation returned no image URLs. output={g

Error message

DashScope image generation returned no image URLs. output={getattr(response, 'output', None)}

What it means

When DashScope returns HTTP status 200 but _extract_image_urls finds no image URLs in response.output, generate_image raises this RuntimeError — the call nominally succeeded but contained no usable image results.

Source

Thrown at pixelle_video/services/api_services/image_dashscope.py:116

        if ImageGeneration is None:
            raise RuntimeError("dashscope package not installed. Run: pip install dashscope")

        try:
            messages = [{"role": "user", "content": [{"text": prompt}]}]
            with self._proxy_env():
                response = ImageGeneration.call(
                    model=model,
                    api_key=self.api_key,
                    messages=messages,
                    n=n,
                    size=size,
                    watermark=False,
                )

            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

View on GitHub (pinned to 848b054e4f)

Solutions

  1. Log response.output to inspect the actual structure
  2. Update the dashscope SDK to match the current API response schema
  3. Retry the generation; check account quotas/content policy
  4. Adjust _extract_image_urls parsing to handle the observed output shape

Example fix

// before
results = self._extract_image_urls(response.output)
// after
results = self._extract_image_urls(response.output)
if not results:
    logging.warning("empty output: %s", response.output)
    results = self._extract_image_urls(getattr(response.output, 'results', None) or response.output)
Defensive patterns

Strategy: retry

Validate before calling

results = gen.generate_image(prompt=p, save_dir=out)
if not results:
    raise RuntimeError("no images produced; check response.output")

Try / catch

for attempt in range(3):
    try:
        return gen.generate_image(prompt=p)
    except RuntimeError as e:
        if "no image URLs" in str(e) and attempt < 2:
            time.sleep(2 ** attempt)
            continue
        raise

Prevention

When it happens

Trigger: Provider returns 200 with an empty/unexpected output structure; task still pending with no results; response schema changed after an SDK/API update; prompt yielded zero generations.

Common situations: DashScope API version drift; async generation polled too early; account restrictions returning empty results; logging the output shows output.results missing or empty.

Related errors


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