{"record":{"id":"ba4351924b53f35e","repo":"calesthio/OpenMontage","slug":"operation-must-be-text-to-video-image-to-video-o","errorCode":null,"errorMessage":"operation must be text_to_video, image_to_video, or reference_to_video","messagePattern":"operation must be text_to_video, image_to_video, or reference_to_video","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/video/seedance_ark.py","lineNumber":694,"sourceCode":"            elif action in {\"query\", \"cancel\"} and inputs.get(\"task_id\"):\n                error_data = {\"task_id\": str(inputs[\"task_id\"])}\n            return ToolResult(\n                success=False,\n                data=error_data,\n                error=(\n                    f\"Ark Seedance request failed: {self._safe_error(exc, api_key)}\"\n                ),\n                duration_seconds=round(time.time() - started, 2),\n            )\n\n    def _build_payload(self, inputs: dict[str, Any]) -> dict[str, Any]:\n        operation = str(inputs.get(\"operation\", \"text_to_video\"))\n        if operation not in {\n            \"text_to_video\",\n            \"image_to_video\",\n            \"reference_to_video\",\n        }:\n            raise ValueError(\n                \"operation must be text_to_video, image_to_video, or reference_to_video\"\n            )\n\n        model, variant = self._resolve_model(inputs)\n        resolution = str(inputs.get(\"resolution\", \"720p\")).lower()\n        if resolution not in self.OUTPUT_DIMENSIONS:\n            raise ValueError(\"resolution must be 480p, 720p, 1080p, or 4k\")\n        if variant in {\"2.5\", \"fast\", \"mini\"} and resolution not in {\n            \"480p\",\n            \"720p\",\n        }:\n            raise ValueError(f\"{variant} supports only 480p or 720p resolution\")\n\n        ratio = str(inputs.get(\"aspect_ratio\", \"16:9\"))\n        valid_ratios = {\n            \"adaptive\",\n            \"21:9\",\n            \"16:9\",","sourceCodeStart":676,"sourceCodeEnd":712,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/video/seedance_ark.py#L676-L712","documentation":"First validation in `_build_payload`: `operation` (default 'text_to_video') must be exactly one of text_to_video, image_to_video, or reference_to_video. The operation determines the entire content-array structure of the Ark request — text-only, single first-frame image, or multi-reference — so an unknown value cannot be mapped to a payload. Runs before resolution/aspect/duration checks.","triggerScenarios":"Passing `operation: \"t2v\"` / `\"video\"` / `\"img2vid\"` shorthand; a typo like \"image_to_vido\"; wrong-case \"Image_To_Video\"; passing None (becomes 'none').","commonSituations":"Developers porting from other OpenMontage tools or raw API examples that use different operation names; LLM-composed inputs abbreviating; docs from a different Seedance gateway (fal, BytePlus) with their own operation vocabulary.","solutions":["Use one of the three exact lowercase strings: 'text_to_video', 'image_to_video', 'reference_to_video'","text-only → text_to_video; one still as first frame → image_to_video; multiple images/video refs → reference_to_video","Check the tool schema's enum before calling"],"exampleFix":"# before\ninputs = {\"operation\": \"t2v\", \"prompt\": \"...\"}\n# after\ninputs = {\"operation\": \"text_to_video\", \"prompt\": \"...\"}","handlingStrategy":"validation","validationCode":"op = str(inputs.get(\"operation\", \"text_to_video\"))\nif op not in {\"text_to_video\", \"image_to_video\", \"reference_to_video\"}:\n    raise ValueError(f\"operation {op!r} invalid\")","typeGuard":"def is_valid_operation(op: object) -> bool:\n    return str(op) in {\"text_to_video\", \"image_to_video\", \"reference_to_video\"}","tryCatchPattern":null,"preventionTips":["Use dry_run to validate the whole payload before the paid execute","Define operation constants once in your calling code"],"tags":["seedance","ark","input-validation","video-generation"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}