{"record":{"id":"dacbebf699a476e7","repo":"calesthio/OpenMontage","slug":"conflicting-audio-input-between-top-level-fields-a","errorCode":null,"errorMessage":"Conflicting audio input between top-level fields and face_choose[0]","messagePattern":"Conflicting audio input between top-level fields and face_choose\\[0\\]","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"tools/avatar/kling_lip_sync.py","lineNumber":608,"sourceCode":"        nested_audio_id = str(payload.get(\"audio_id\") or \"\").strip()\n        nested_sound_file = payload.get(\"sound_file\")\n        if nested_audio_id and nested_sound_file:\n            raise ValueError(\n                \"Conflicting audio input in face_choose[0]; provide audio_id or sound_file, not both\"\n            )\n\n        top_level_audio_id = str(inputs.get(\"audio_id\") or \"\").strip()\n        top_level_sound_requested = any(\n            inputs.get(key)\n            for key in (\"sound_file\", \"sound_file_url\", \"sound_file_path\", \"audio_path\")\n        )\n\n        if nested_audio_id:\n            if (\n                (top_level_audio_id and top_level_audio_id != nested_audio_id)\n                or top_level_sound_requested\n            ):\n                raise ValueError(\n                    \"Conflicting audio input between top-level fields and face_choose[0]\"\n                )\n            payload[\"audio_id\"] = nested_audio_id\n            return {\"type\": \"audio_id\", \"value\": nested_audio_id}\n\n        if nested_sound_file:\n            if top_level_audio_id:\n                raise ValueError(\n                    \"Conflicting audio input between top-level fields and face_choose[0]\"\n                )\n            if top_level_sound_requested:\n                top_level_sound_file = normalize_media_input(\n                    url=inputs.get(\"sound_file_url\"),\n                    path=inputs.get(\"sound_file_path\") or inputs.get(\"audio_path\"),\n                    value=inputs.get(\"sound_file\"),\n                    label=\"Lip-sync audio file\",\n                )\n                if top_level_sound_file != nested_sound_file:","sourceCodeStart":590,"sourceCodeEnd":626,"githubUrl":"https://github.com/calesthio/OpenMontage/blob/95e1c3d0ab93482159818560f6a8c8e866b9139f/tools/avatar/kling_lip_sync.py#L590-L626","documentation":"Raised by KlingLipSyncTool._copy_audio_input when face_choose[0] carries an audio_id and it conflicts with the top level: either a different top-level audio_id was also provided, or any top-level sound source (sound_file, sound_file_url, sound_file_path, audio_path) was set. A nested audio_id must be the sole audio source.","triggerScenarios":"inputs = {'audio_id': 'audio_A', 'face_choose': [{'audio_id': 'audio_B'}]} (different ids), or inputs = {'sound_file_path': 'vo.mp3', 'face_choose': [{'audio_id': 'audio_B'}]} (nested id + top-level file).","commonSituations":"Setting a global fallback audio 'just in case' while also specifying per-face audio ids; payloads assembled from two sources (global config + per-shot spec).","solutions":["Remove the top-level audio fields when face_choose[0] specifies audio_id","If a global audio is intended, remove audio_id from face_choose[0] and keep only the top-level one","Keep exactly one audio source per call: one of audio_id / sound_file* at one scope"],"exampleFix":"# before\ninputs = {\"sound_file_path\": \"vo.mp3\", \"face_choose\": [{\"face_id\": \"f1\", \"audio_id\": \"audio_B\"}]}\n\n# after\ninputs = {\"face_choose\": [{\"face_id\": \"f1\", \"audio_id\": \"audio_B\"}]}","handlingStrategy":"validation","validationCode":"face_item = (inputs.get(\"face_choose\") or [{}])[0]\nnested_id = str(face_item.get(\"audio_id\") or \"\").strip()\ntop_sound = any(inputs.get(k) for k in (\"sound_file\", \"sound_file_url\", \"sound_file_path\", \"audio_path\"))\nif nested_id and ((str(inputs.get(\"audio_id\") or \"\").strip() and str(inputs.get(\"audio_id\")) != nested_id) or top_sound):\n    raise ValueError(\"nested audio_id conflicts with top-level audio\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["A nested audio_id must be the only audio input in the whole payload","Never add a global audio fallback alongside per-face audio ids","Keep a single audio-spec helper that writes into exactly one scope"],"tags":["kling","lip-sync","audio-input","conflicting-inputs"],"backgroundTag":null,"analyzedSha":"95e1c3d0ab93482159818560f6a8c8e866b9139f","analyzedAt":"2026-08-15T06:31:20.014Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}