HKUDS/nanobot · error · ImageGenerationError

Zhipu image generation does not support reference images

Error message

Zhipu image generation does not support reference images

What it means

Validation guard in ZhipuImageGenerator.generate: reference images were supplied but Zhipu's CogView-style image generation API does not support image inputs, so the request is rejected immediately before any network call.

Solutions

  1. Remove the reference images and use a text-only prompt
  2. Or switch to a provider that supports reference/image inputs (e.g. GPT Image or MiniMax subject reference)
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nanobot/providers/image_generation.py:1829 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/411e977e988c75bc. Report an issue: GitHub.

Appendix: source

Thrown at nanobot/providers/image_generation.py:1829

    default_timeout = _ZHIPU_TIMEOUT_S

    def _default_base_url(self) -> str:
        return "https://open.bigmodel.cn/api/paas/v4"

    async def generate(
        self,
        *,
        prompt: str,
        model: str,
        reference_images: list[str] | None = None,
        aspect_ratio: str | None = None,
        image_size: str | None = None,
    ) -> GeneratedImageResponse:
        if not self.api_key:
            raise ImageGenerationError(self.missing_key_message)

        if reference_images:
            raise ImageGenerationError(
                "Zhipu image generation does not support reference images"
            )

        headers = {
            "Authorization": f"Bearer {self.api_key}",
            "Content-Type": "application/json",
            **self.extra_headers,
        }

        body: dict[str, Any] = {
            "model": model,
            "prompt": prompt,
        }

        size = _zhipu_size(aspect_ratio, image_size)
        if size:
            body["size"] = size

View on GitHub (pinned to 42f37dc4c0)