HKUDS/nanobot · error · ImageGenerationError

MiniMax image generation failed

Error message

MiniMax image generation failed: {detail}

What it means

Raised in MiniMaxImageGenerator._generate_with_client when the image_generation response has a non-2xx status. Wraps httpx.HTTPStatusError; detail carries the upstream error body, so MiniMax rejected the request (invalid key, bad parameters, content policy).

Solutions

  1. Verify the MiniMax API key is set and valid
  2. Inspect detail for parameter or policy errors and adjust prompt/body
  3. Review extra_body overrides for invalid fields
  4. Retry after correcting the request
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at nanobot/providers/image_generation.py:1067 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/9e8289cfccdfabb5. Report an issue: GitHub.

Appendix: source

Thrown at nanobot/providers/image_generation.py:1067

    async def _generate_with_client(
        self,
        body: dict[str, Any],
        headers: dict[str, str],
    ) -> GeneratedImageResponse:
        url = f"{self.api_base}/image_generation"
        try:
            response = await self._http_post(url, headers=headers, body=body)
        except httpx.TimeoutException as exc:
            raise ImageGenerationError("MiniMax image generation timed out") from exc
        except httpx.RequestError as exc:
            raise ImageGenerationError(f"MiniMax image generation request failed: {exc}") from exc

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

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

        self._require_images(images, payload)

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


def _minimax_images_from_payload(payload: dict[str, Any]) -> list[str]:
    """Extract base64 images from MiniMax API response.

    MiniMax returns images in ``data.image_base64`` (list of base64 strings).
    """
    images: list[str] = []
    data = payload.get("data")
    data_object = _as_json_object(data)
    if data_object is None:

View on GitHub (pinned to 42f37dc4c0)