{"record":{"id":"ac48e66acdb99c67","repo":"calesthio/OpenMontage","slug":"image-to-video-requires-image-url-or-image-path","errorCode":null,"errorMessage":"image_to_video requires image_url or image_path","messagePattern":"image_to_video requires image_url or image_path","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/video/grok_video.py","lineNumber":199,"sourceCode":"\n    def _build_payload(self, inputs: dict[str, Any]) -> dict[str, Any]:\n        operation = inputs.get(\"operation\", \"text_to_video\")\n        payload: dict[str, Any] = {\n            \"model\": inputs.get(\"model\", \"grok-imagine-video\"),\n            \"prompt\": inputs[\"prompt\"],\n        }\n\n        if operation != \"reference_to_video\":\n            payload[\"duration\"] = int(inputs.get(\"duration\", 5))\n            if inputs.get(\"aspect_ratio\"):\n                payload[\"aspect_ratio\"] = inputs[\"aspect_ratio\"]\n            if inputs.get(\"resolution\"):\n                payload[\"resolution\"] = self._normalize_resolution(inputs[\"resolution\"])\n\n        if operation == \"image_to_video\":\n            image = _normalize_media_ref(inputs.get(\"image_url\"), inputs.get(\"image_path\"))\n            if not image:\n                raise ValueError(\"image_to_video requires image_url or image_path\")\n            payload[\"image\"] = image\n        elif operation == \"reference_to_video\":\n            refs = [{\"url\": url} for url in (inputs.get(\"reference_image_urls\") or [])]\n            refs.extend(\n                {\"url\": _file_to_data_uri(path)}\n                for path in (inputs.get(\"reference_image_paths\") or [])\n            )\n            if not refs:\n                raise ValueError(\n                    \"reference_to_video requires reference_image_urls or reference_image_paths\"\n                )\n            payload[\"reference_images\"] = refs\n            payload[\"duration\"] = int(inputs.get(\"duration\", 5))\n            if inputs.get(\"aspect_ratio\"):\n                payload[\"aspect_ratio\"] = inputs[\"aspect_ratio\"]\n            if inputs.get(\"resolution\"):\n                payload[\"resolution\"] = self._normalize_resolution(inputs[\"resolution\"])\n","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/video/grok_video.py#L181-L217","documentation":"Raised during payload construction when operation=image_to_video is selected but neither image_url nor image_path was provided. _normalize_media_ref returns None for both missing inputs, and the tool refuses to build an image-to-video request without a source image — this fails fast before any API call.","triggerScenarios":"Calling grok_video with operation='image_to_video' and inputs lacking both the image_url and image_path keys (or both empty/None).","commonSituations":"Copy-pasting a text_to_video input dict and only changing the operation string; upstream code conditionally setting the image key and the condition silently skipping it; key-name typos like image_urls or imagePath.","solutions":["Add image_url (remote) or image_path (local file) to the inputs for image_to_video.","Switch operation to text_to_video if no source image is intended.","Check for key typos — the exact keys are image_url and image_path."],"exampleFix":"# before\n{\"operation\": \"image_to_video\", \"prompt\": \"...\"}  # no image\n\n# after\n{\"operation\": \"image_to_video\", \"prompt\": \"...\", \"image_path\": \"/abs/first_frame.png\"}","handlingStrategy":"validation","validationCode":"def validate_grok_inputs(inputs: dict) -> None:\n    op = inputs.get(\"operation\", \"text_to_video\")\n    if op == \"image_to_video\" and not (inputs.get(\"image_url\") or inputs.get(\"image_path\")):\n        raise ValueError(\"image_to_video needs image_url or image_path\")\n    if op == \"reference_to_video\" and not (\n        inputs.get(\"reference_image_urls\") or inputs.get(\"reference_image_paths\")\n    ):\n        raise ValueError(\"reference_to_video needs reference lists\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate operation-specific required keys before calling the tool.","Build inputs with a small helper that sets image_url/image_path together with the operation."],"tags":["grok","validation","missing-argument","image-to-video"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}