{"record":{"id":"fbb67be56c214b1a","repo":"Comfy-Org/ComfyUI","slug":"gemini-did-not-generate-a-video-model-response","errorCode":null,"errorMessage":"Gemini did not generate a video. Model response: {model_message}","messagePattern":"Gemini did not generate a video\\. Model response: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_gemini.py","lineNumber":267,"sourceCode":"    return \"\\n\".join(texts)\n\n\nasync def get_video_from_interaction(\n    interaction: GeminiInteraction, cls: type[IO.ComfyNode] | None = None\n) -> InputImpl.VideoFromFile:\n    for step in interaction.steps or []:\n        if step.type != \"model_output\":\n            continue\n        for content in step.content or []:\n            if content.type != \"video\":\n                continue\n            if content.data:\n                return InputImpl.VideoFromFile(BytesIO(base64.b64decode(content.data)))\n            if content.uri:\n                return await download_url_to_video_output(content.uri, cls=cls)\n    model_message = get_text_from_interaction(interaction).strip()\n    if model_message:\n        raise ValueError(f\"Gemini did not generate a video. Model response: {model_message}\")\n    raise ValueError(\n        \"Gemini did not generate a video. Try rephrasing your prompt, \"\n        \"shortening the requested duration, or reducing the number of input images/videos.\"\n    )\n\n\ndef create_video_parts(video_input: Input.Video) -> list[GeminiPart]:\n    \"\"\"Convert a single video input to Gemini API compatible parts (inline MP4/H.264).\"\"\"\n    base_64_string = video_to_base64_string(\n        video_input, container_format=Types.VideoContainer.MP4, codec=Types.VideoCodec.H264\n    )\n    return [\n        GeminiPart(\n            inlineData=GeminiInlineData(\n                mimeType=GeminiMimeType.video_mp4,\n                data=base_64_string,\n            )\n        )","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_gemini.py#L249-L285","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Read the appended Model response text — it is the model's own reason for not generating video and usually names the fix.","Rephrase the prompt as an explicit video-generation instruction rather than a question.","Shorten the requested duration and reduce the number of input images/videos attached to the interaction.","Retry once; occasional text-only replies are nondeterministic."],"exampleFix":"// before\nvideo = await get_video_from_interaction(interaction, cls=cls)  # raises: Gemini did not generate a video. Model response: ...\n\n// after\nvideo = await get_video_from_interaction(interaction, cls=cls)  # keep, but inspect interaction first:\nif not interaction_has_video(interaction):\n    log.warning(\"model said: %s\", get_text_from_interaction(interaction).strip())\n    video = await get_video_from_interaction(interaction, cls=cls)","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    video = await get_video_from_interaction(interaction, cls=cls)\nexcept ValueError as e:\n    if \"did not generate a video\" in str(e):\n        reason = str(e).split(\"Model response:\")[-1].strip()\n        log.warning(\"gemini video refusal: %s\", reason)\n        video = await get_video_from_interaction(await retry_interaction(simplified_request), cls=cls)\n    else:\n        raise","preventionTips":["Phrase video prompts as direct generation instructions, not questions.","Keep requested durations and input counts modest on first attempts.","Log the appended Model response text whenever this fires — it states the actual constraint."],"tags":["gemini","video-generation","interactions-api","comfy-api-nodes"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}