{"record":{"id":"29e2954a7b04ff0e","repo":"calesthio/OpenMontage","slug":"kling-identify-face-requires-video-url-or-video-id","errorCode":null,"errorMessage":"Kling identify_face requires video_url or video_id; local video paths cannot be silently uploaded.","messagePattern":"Kling identify_face requires video_url or video_id; local video paths cannot be silently uploaded\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/avatar/kling_lip_sync.py","lineNumber":350,"sourceCode":"                \"output\": str(paths[0]),\n                \"output_path\": str(paths[0]),\n                \"video_paths\": [str(path) for path in paths],\n                \"format\": \"mp4\",\n                \"cost_estimate_confidence\": \"low\",\n                \"cost_estimate_basis\": \"Conservative estimate pending official account-usage reconciliation.\",\n                **self._account_usage_result(inputs, client),\n                **self._callback_result_data(inputs, task_id),\n                **probed,\n            },\n            artifacts=[str(path) for path in paths],\n            cost_usd=self.estimate_cost(inputs),\n            duration_seconds=round(time.time() - start, 2),\n            model=\"kling-official-lip-sync\",\n        )\n\n    def _build_identify_request(self, inputs: dict[str, Any]) -> dict[str, Any]:\n        if inputs.get(\"video_path\") and not (inputs.get(\"video_url\") or inputs.get(\"video_id\")):\n            raise ValueError(\"Kling identify_face requires video_url or video_id; local video paths cannot be silently uploaded.\")\n        payload: dict[str, Any] = {}\n        if inputs.get(\"video_id\"):\n            payload[\"video_id\"] = str(inputs[\"video_id\"])\n        if inputs.get(\"video_url\"):\n            payload[\"video_url\"] = str(inputs[\"video_url\"])\n        if not payload:\n            raise ValueError(\"Kling identify_face requires video_id or video_url\")\n        return {\n            \"path\": \"/v1/videos/identify-face\",\n            \"payload\": payload,\n            \"operation\": \"identify_face\",\n        }\n\n    def _build_advanced_request(self, inputs: dict[str, Any]) -> dict[str, Any]:\n        session_id = str(inputs.get(\"session_id\") or \"\").strip()\n        if not session_id:\n            raise ValueError(\"advanced_lip_sync requires session_id\")\n        face_choose = self._normalize_face_choose(inputs)","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/avatar/kling_lip_sync.py#L332-L368","documentation":"ValueError from _build_identify_request when video_path is supplied but neither video_url nor video_id is. This is a deliberate guard: identify-face requires a Kling-hosted video, and the tool refuses to silently upload a local file (which would spend quota and have side effects the caller did not ask for). The message tells the developer the upload must be explicit.","triggerScenarios":"Calling kling_lip_sync operation='identify_face' (or the auto flow) with only video_path pointing to a local file.","commonSituations":"Pipeline renders a local video then immediately tries lip-sync; developer assumes the tool auto-uploads like some other tools do.","solutions":["Upload the local video first (Kling upload/video-creation endpoint or a tool that returns video_id/video_url), then pass video_id or video_url.","Or host the file at a public URL and pass video_url.","Do not pass video_path together with the expectation of implicit upload — it will always fail fast."],"exampleFix":"// before\nresult = tool.run({\"operation\": \"identify_face\", \"video_path\": \"clip.mp4\"})\n\n// after\nvideo_id = kling_upload(\"clip.mp4\")  # explicit upload step\nresult = tool.run({\"operation\": \"identify_face\", \"video_id\": video_id})","handlingStrategy":"validation","validationCode":"if inputs.get(\"video_path\") and not (inputs.get(\"video_url\") or inputs.get(\"video_id\")):\n    inputs[\"video_id\"] = upload_video(inputs[\"video_path\"])  # explicit upload","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Upload local videos explicitly and pass video_id/video_url — never rely on video_path for identify_face","Build the upload step into the pipeline so local files always have a Kling-side reference"],"tags":["kling","lip-sync","input-validation","explicit-upload"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}