{"record":{"id":"18c5d3ec30bc3b81","repo":"calesthio/OpenMontage","slug":"reference-to-video-requires-reference-image-urls-o","errorCode":null,"errorMessage":"reference_to_video requires reference_image_urls or reference_image_paths","messagePattern":"reference_to_video requires reference_image_urls or reference_image_paths","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/video/grok_video.py","lineNumber":208,"sourceCode":"            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\n        return payload\n\n    def execute(self, inputs: dict[str, Any]) -> ToolResult:\n        api_key = os.environ.get(\"XAI_API_KEY\")\n        if not api_key:\n            return ToolResult(\n                success=False,\n                error=\"XAI_API_KEY not set. \" + self.install_instructions,\n            )","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/video/grok_video.py#L190-L226","documentation":"Raised when operation=reference_to_video is selected but both reference_image_urls and reference_image_paths are empty. The tool builds a reference_images array from those two inputs; if the combined list is empty it raises ValueError rather than sending a reference-free request, which would not match the requested operation.","triggerScenarios":"Calling grok_video with operation='reference_to_video' where reference_image_urls is None/[] and reference_image_paths is None/[].","commonSituations":"Upstream filtering empties the reference list (e.g. all candidates failed a download step); key typos (reference_image_urls vs reference_images); reusing an image_to_video payload without migrating the image field into a reference list.","solutions":["Provide at least one entry in reference_image_urls or reference_image_paths.","If migrating from image_to_video, move the image into one of the reference list keys.","Log the reference list length upstream to catch filtering stages that silently drop every candidate."],"exampleFix":"# before\n{\"operation\": \"reference_to_video\", \"prompt\": \"...\"}\n\n# after\n{\"operation\": \"reference_to_video\", \"prompt\": \"...\", \"reference_image_urls\": [\"https://cdn.example.com/ref1.png\"]}","handlingStrategy":"validation","validationCode":"refs = list(inputs.get(\"reference_image_urls\") or []) + list(inputs.get(\"reference_image_paths\") or [])\nif inputs.get(\"operation\") == \"reference_to_video\" and not refs:\n    raise ValueError(\"reference_to_video: reference list is empty after upstream filtering\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Log the reference count right before invoking grok_video.","Fail the pipeline when a download/filter stage drops all candidates instead of passing an empty list downstream."],"tags":["grok","validation","missing-argument","reference-video"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}