{"record":{"id":"d42992bbf6a70841","repo":"calesthio/OpenMontage","slug":"advanced-lip-sync-requires-session-id","errorCode":null,"errorMessage":"advanced_lip_sync requires session_id","messagePattern":"advanced_lip_sync requires session_id","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/avatar/kling_lip_sync.py","lineNumber":367,"sourceCode":"        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)\n        if not face_choose:\n            raise ValueError(\"advanced_lip_sync requires face_choose or face_id\")\n        if len(face_choose) != 1:\n            raise ValueError(\"advanced_lip_sync currently supports exactly one face_choose item\")\n        face_item = face_choose[0]\n        audio_source = self._copy_audio_input(inputs, face_item)\n        self._copy_timing_fields(inputs, face_item)\n        payload: dict[str, Any] = {\n            \"session_id\": session_id,\n            \"face_choose\": face_choose,\n        }\n        self._copy_common_task_fields(inputs, payload)\n        return {\n            \"protocol\": \"classic\",\n            \"path\": \"/v1/videos/advanced-lip-sync\",\n            \"payload\": payload,\n            \"operation\": \"advanced_lip_sync\",","sourceCodeStart":349,"sourceCodeEnd":385,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/avatar/kling_lip_sync.py#L349-L385","documentation":"ValueError from _build_advanced_request when inputs.session_id is missing or whitespace after strip. advanced_lip_sync is the second half of a two-step flow: it reuses the session created by identify_face. Calling it standalone without that handle is a protocol error, not a transient failure.","triggerScenarios":"Calling operation='advanced_lip_sync' without first running operation='identify_face'; session_id key misspelled or None because the identify step's result was not threaded through.","commonSituations":"Developer assumes advanced_lip_sync is self-contained; orchestration code drops the session_id between steps; stale session_id from a previous run (different failure — Kling rejects it server-side).","solutions":["Run identify_face first and pass its returned session_id into advanced_lip_sync.","Or use the tool's combined/auto flow, which merges session_id automatically (see the dispatch code above line 241).","Verify the key name is exactly 'session_id'."],"exampleFix":"// before\nresult = tool.run({\"operation\": \"advanced_lip_sync\", \"face_id\": \"1\", \"audio_path\": \"a.mp3\"})\n\n// after\nidentify = tool.run({\"operation\": \"identify_face\", \"video_url\": v})\nsession_id = identify.data[\"session_id\"]\nresult = tool.run({\"operation\": \"advanced_lip_sync\", \"session_id\": session_id, \"face_id\": \"1\", \"audio_path\": \"a.mp3\"})","handlingStrategy":"validation","validationCode":"identify = tool.run({\"operation\": \"identify_face\", \"video_url\": video_url})\nsession_id = identify.data.get(\"session_id\")\nassert session_id, \"identify_face must run first to produce session_id\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run the identify_face step first and thread its session_id through","Prefer the tool's combined auto flow, which injects session_id automatically"],"tags":["kling","lip-sync","required-field","workflow-order"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}