HKUDS/nanobot · error · ImageGenerationError

StepFun image generation failed

Error message

StepFun image generation failed: {detail}

What it means

Raised in the StepFun image generator's generate when POST {api_base}/images/generations returns a non-2xx status. Wraps httpx.HTTPStatusError with up to 500 chars of the response body as detail, meaning StepFun rejected the request (auth, quota, model, or parameter issues).

Solutions

  1. Verify the StepFun API key
  2. Check detail for quota (429) or invalid-parameter errors and adjust
  3. Review model name and extra_body overrides
  4. Retry after correcting the request
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at nanobot/providers/image_generation.py:1742 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HKUDS/nanobot@42f37dc4c0 (2026-08-26). Data as JSON: /api/errors/1883f7f6c0546247. Report an issue: GitHub.

Appendix: source

Thrown at nanobot/providers/image_generation.py:1742

        refs = list(reference_images or [])
        if refs and "1x" in model:
            body["style_reference"] = {
                "source_url": image_path_to_data_url(refs[0]),
            }

        body.update(self.extra_body)

        response = await self._http_post(
            f"{self.api_base}/images/generations",
            headers=headers,
            body=body,
        )

        try:
            response.raise_for_status()
        except httpx.HTTPStatusError as exc:
            detail = response.text[:500]
            raise ImageGenerationError(
                f"StepFun image generation failed: {detail}"
            ) from exc

        payload = response.json()
        images = _stepfun_images_from_payload(payload)

        self._require_images(images, payload)

        return GeneratedImageResponse(images=images, content="", raw=payload)


def _stepfun_size(
    aspect_ratio: str | None,
    image_size: str | None,
) -> str:
    """Resolve aspect ratio / image_size to StepFun size string.

    StepFun expects ``WIDTHxHEIGHT`` (note: width x height, not the more

View on GitHub (pinned to 42f37dc4c0)