{"record":{"id":"0b51a7d3ac0ba207","repo":"Comfy-Org/ComfyUI","slug":"connect-reference-audio-inputs-in-order-without-ga","errorCode":null,"errorMessage":"Connect reference_audio inputs in order without gaps: reference_audio_1, then _2, then _3.","messagePattern":"Connect reference_audio inputs in order without gaps: reference_audio_1, then _2, then _3\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_bytedance.py","lineNumber":3170,"sourceCode":"    preset_voice: str | None = None,\n) -> None:\n    validate_string(text_prompt, field_name=\"text_prompt\", min_length=1, max_length=3000)\n    max_tag = max_audio_tag(text_prompt)\n\n    if mode == MODE_TEXT:\n        if max_tag:\n            raise ValueError(\n                f\"The prompt references @Audio{max_tag}, but reference mode is '{MODE_TEXT}'. \"\n                f\"Switch to '{MODE_AUDIO}' and connect the reference clip(s).\"\n            )\n    elif mode == MODE_AUDIO:\n        if not audio_indices:\n            raise ValueError(\n                f\"Reference mode '{MODE_AUDIO}' requires at least one reference_audio input \"\n                f\"(or switch to '{MODE_TEXT}').\"\n            )\n        if audio_indices != list(range(1, len(audio_indices) + 1)):\n            raise ValueError(\n                \"Connect reference_audio inputs in order without gaps: reference_audio_1, then _2, then _3.\"\n            )\n        if max_tag > len(audio_indices):\n            raise ValueError(\n                f\"The prompt references @Audio{max_tag}, but only {len(audio_indices)} \"\n                f\"reference audio(s) are connected.\"\n            )\n    elif mode == MODE_IMAGE:\n        if not has_image:\n            raise ValueError(f\"Reference mode '{MODE_IMAGE}' requires a reference_image input.\")\n        if max_tag:\n            raise ValueError(\n                f\"@AudioN tags are not used in '{MODE_IMAGE}' mode; the prompt should contain \"\n                f\"only the text to synthesize.\"\n            )\n    elif mode == MODE_SPEAKER:\n        if not preset_voice or preset_voice not in SEED_AUDIO_VOICE_MAP:\n            raise ValueError(f\"Reference mode '{MODE_SPEAKER}' requires selecting a preset voice.\")","sourceCodeStart":3152,"sourceCodeEnd":3188,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_bytedance.py#L3152-L3188","documentation":"The node collects connected reference_audio inputs as indices (1, 2, 3, ...). In 'audio reference' mode they must be contiguous starting at 1: audio_indices must equal list(range(1, len+1)). Gaps (e.g. only reference_audio_2 connected, or _1 and _3) are rejected because @Audio{N} tags map positionally to these inputs.","triggerScenarios":"Connecting reference_audio_2 without reference_audio_1, or wiring _1 and _3 while leaving _2 empty, with mode='audio reference'.","commonSituations":"Deleting a middle audio node in the graph; users assuming any subset of the numbered inputs is valid; reconnecting clips after rearranging a workflow.","solutions":["Reconnect clips so inputs are filled in order: reference_audio_1 first, then _2, then _3, with no gaps.","If you need fewer references, move the later clips down to the lower-numbered inputs."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if audio_indices != list(range(1, len(audio_indices) + 1)):\n    raise ValueError(\"fill reference_audio inputs 1..N with no gaps\")","typeGuard":"def audio_indices_contiguous(indices: list[int]) -> bool:\n    return indices == list(range(1, len(indices) + 1))","tryCatchPattern":null,"preventionTips":["Always fill reference_audio inputs starting at _1, in order.","After deleting a clip, shift the remaining clips down to close the gap."],"tags":["bytedance","seed-audio","validation","input-order","api-nodes"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}