Comfy-Org/ComfyUI · error · ValueError

Gemini did not generate a video. Model response: {model_mess

Error message

Gemini did not generate a video. Model response: {model_message}

What it means

Raised by the Gemini Interactions API video path when the completed interaction contains no content entries of type 'video' (neither inline base64 data nor a downloadable URI), and the model did return text. The embedded {model_message} is the model's own explanation, which usually names the reason (e.g. request refused, duration too long, too many inputs). This is the informative sibling of the bare 'no video' error at index 402.

Source

Thrown at comfy_api_nodes/nodes_gemini.py:267

    return "\n".join(texts)


async def get_video_from_interaction(
    interaction: GeminiInteraction, cls: type[IO.ComfyNode] | None = None
) -> InputImpl.VideoFromFile:
    for step in interaction.steps or []:
        if step.type != "model_output":
            continue
        for content in step.content or []:
            if content.type != "video":
                continue
            if content.data:
                return InputImpl.VideoFromFile(BytesIO(base64.b64decode(content.data)))
            if content.uri:
                return await download_url_to_video_output(content.uri, cls=cls)
    model_message = get_text_from_interaction(interaction).strip()
    if model_message:
        raise ValueError(f"Gemini did not generate a video. Model response: {model_message}")
    raise ValueError(
        "Gemini did not generate a video. Try rephrasing your prompt, "
        "shortening the requested duration, or reducing the number of input images/videos."
    )


def create_video_parts(video_input: Input.Video) -> list[GeminiPart]:
    """Convert a single video input to Gemini API compatible parts (inline MP4/H.264)."""
    base_64_string = video_to_base64_string(
        video_input, container_format=Types.VideoContainer.MP4, codec=Types.VideoCodec.H264
    )
    return [
        GeminiPart(
            inlineData=GeminiInlineData(
                mimeType=GeminiMimeType.video_mp4,
                data=base_64_string,
            )
        )

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Read the appended Model response text — it is the model's own reason for not generating video and usually names the fix.
  2. Rephrase the prompt as an explicit video-generation instruction rather than a question.
  3. Shorten the requested duration and reduce the number of input images/videos attached to the interaction.
  4. Retry once; occasional text-only replies are nondeterministic.

Example fix

// before
video = await get_video_from_interaction(interaction, cls=cls)  # raises: Gemini did not generate a video. Model response: ...

// after
video = await get_video_from_interaction(interaction, cls=cls)  # keep, but inspect interaction first:
if not interaction_has_video(interaction):
    log.warning("model said: %s", get_text_from_interaction(interaction).strip())
    video = await get_video_from_interaction(interaction, cls=cls)
Defensive patterns

Strategy: fallback

Try / catch

try:
    video = await get_video_from_interaction(interaction, cls=cls)
except ValueError as e:
    if "did not generate a video" in str(e):
        reason = str(e).split("Model response:")[-1].strip()
        log.warning("gemini video refusal: %s", reason)
        video = await get_video_from_interaction(await retry_interaction(simplified_request), cls=cls)
    else:
        raise

Prevention

When it happens

Trigger: Gemini video/omni interaction execute where every step's content list lacks type=='video' entries (no content.data and no content.uri) and get_text_from_interaction() returns non-empty text. Happens when the model answers the prompt conversationally instead of generating video, e.g. asking for something it deems unsupported.

Common situations: Prompt phrased as a question so the model replies with text instead of video; requests for durations/resolutions the current model does not support; too many input images/videos causing the model to explain its limit rather than generate; safety-related refusals that come back as text.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/fbb67be56c214b1a. Report an issue: GitHub.