ATH-MaaS/Pixelle-Video · error · RuntimeError

API image generation returned no result: provider={provider}

Error message

API image generation returned no result: provider={provider}, model={model}

What it means

_generate_image calls the provider API and expects one or more output file paths back; when the returned paths list is empty it raises RuntimeError naming the provider and model, since image generation produced nothing.

Source

Thrown at pixelle_video/services/api_media.py:501

        save_dir = self._save_dir(output_path, "api_images")
        ratio = self._ratio(width, height)
        resolution = self._resolution(width, height)
        session_id = params.get("session_id") or "pixelle"

        logger.info(f"Generating image via API provider={provider}, model={model}")
        paths = await asyncio.to_thread(
            client.generate_image,
            prompt=prompt,
            image_paths=image_paths,
            model=model,
            save_dir=save_dir,
            session_id=session_id,
            video_ratio=ratio,
            resolution=resolution,
        )

        if not paths:
            raise RuntimeError(f"API image generation returned no result: provider={provider}, model={model}")

        result_path = paths[0]
        if output_path and os.path.exists(result_path) and os.path.abspath(result_path) != os.path.abspath(output_path):
            os.makedirs(os.path.dirname(output_path), exist_ok=True)
            os.replace(result_path, output_path)
            result_path = output_path

        return MediaResult(media_type="image", url=result_path)

    async def _generate_video(
        self,
        provider: str,
        model: str,
        prompt: str,
        image_path: Optional[str],
        output_path: Optional[str],
        duration: Optional[float],
        width: Optional[int],

View on GitHub (pinned to 848b054e4f)

Solutions

  1. Retry with the same request — transient provider failures often produce empty results
  2. Check provider-side quota/status and any provider error logs for the request
  3. Adjust prompt (avoid safety-filter triggers) and validate ratio/resolution against the model's supported values
  4. Confirm the provider/model key is valid via resolve_workflow before calling

Example fix

# before
path = await api_media.generate_image(prompt=p, workflow=wf)  # may raise empty-result
# after
try:
    path = await api_media.generate_image(prompt=p, workflow=wf)
except RuntimeError:
    path = await api_media.generate_image(prompt=p, workflow=wf)  # one retry
Defensive patterns

Strategy: retry

Validate before calling

# validate workflow resolves before generating
meta = service.resolve_workflow(workflow)  # raises ValueError if invalid

Try / catch

for attempt in range(3):
    try:
        return await api_media(prompt=prompt, workflow=workflow, media_type="image")
    except RuntimeError as e:
        if "returned no result" not in str(e):
            raise
        await asyncio.sleep(2 ** attempt)
raise RuntimeError("image generation returned no result after retries")

Prevention

When it happens

Trigger: Provider/model returned zero output paths — generation rejected by content filter, provider error swallowed into an empty result, invalid params (ratio/resolution), or exhausted quota.

Common situations: Prompt flagged by the provider's safety filter; free-tier quota exhausted; unsupported resolution/ratio combination for the model; transient provider 5xx surfaced as empty result.

Related errors


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