{"record":{"id":"9e2a84e1977c72ae","repo":"Comfy-Org/ComfyUI","slug":"the-prompt-references-audio-max-tag-but-only-l","errorCode":null,"errorMessage":"The prompt references @Audio{max_tag}, but only {len(audio_indices)} reference audio(s) are connected.","messagePattern":"The prompt references @Audio(.+?), but only (.+?) reference audio\\(s\\) are connected\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_bytedance.py","lineNumber":3174,"sourceCode":"\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.\")\n        if max_tag > 1:\n            raise ValueError(\n                f\"'{MODE_SPEAKER}' mode uses a single voice, so @Audio{max_tag} is out of range. \"\n                f\"Remove the @AudioN tags — the whole prompt is read in the selected voice.\"","sourceCodeStart":3156,"sourceCodeEnd":3192,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_bytedance.py#L3156-L3192","documentation":"Thrown by the ByteDance Seed Audio 1.0 node when the text prompt contains an @AudioN tag whose index N exceeds the number of connected reference_audio inputs. The node parses @AudioN tags out of the prompt in 'audio reference' mode and requires one connected audio input per tag. It is a workflow-wiring validation error raised before any API call is made.","triggerScenarios":"Node reference_mode is 'audio reference', audio_indices is non-empty and gap-free, but max_tag (the highest @AudioN index found in the prompt) is greater than len(audio_indices). E.g. prompt contains '@Audio3' while only reference_audio_1 and reference_audio_2 are connected.","commonSituations":"User edits the prompt to add a third speaker tag but forgets to wire reference_audio_3; copying a workflow that had more reference audios than the current copy; batching a multi-speaker dialogue script with more @AudioN tags than available voice clips.","solutions":["Connect additional reference_audio_N inputs up to the highest @AudioN index used in the prompt (ensure they are wired in order: _1, then _2, then _3).","Or edit the prompt so the highest @AudioN tag does not exceed the number of connected reference audios (e.g. change '@Audio3' to '@Audio2' or remove it).","If you only have one voice clip, switch reference_mode to 'preset voice' and drop the @AudioN tags entirely."],"exampleFix":"// before: prompt = \"<@Audio1>Hi<@Audio3>Bye\" with only reference_audio_1 connected\n// after:  prompt = \"<@Audio1>Hi<@Audio2>Bye\" with reference_audio_1 and reference_audio_2 connected","handlingStrategy":"validation","validationCode":"import re\n\ndef check_audio_tags(prompt: str, num_reference_audios: int) -> None:\n    tags = [int(n) for n in re.findall(r\"@Audio(\\d+)\", prompt)]\n    if tags and max(tags) > num_reference_audios:\n        raise ValueError(f\"prompt uses @Audio{max(tags)} but only {num_reference_audios} reference audios connected\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the highest @AudioN tag in the prompt equal to the count of wired reference_audio inputs.","Wire reference_audio inputs strictly in order (_1, _2, _3) with no gaps.","Before running the full workflow, validate the prompt's tag count with a regex check in a small script node."],"tags":["comfyui","bytedance","seed-audio","validation","workflow-wiring"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}