Comfy-Org/ComfyUI · error · ValueError

The prompt references @Audio

Error message

The prompt references @Audio{max_tag}, but reference mode is '{MODE_TEXT}'. Switch to '{MODE_AUDIO}' and connect the reference clip(s).

What it means

The Seed-OSS audio node uses @Audio{N} tags in the prompt to reference connected clips. If max_audio_tag(text_prompt) finds such a tag but the mode widget is 'text only' (MODE_TEXT), the tag has no meaning and the node refuses to run, telling the user to switch to 'audio reference' mode and connect the clips.

Solutions

  1. Switch the mode widget to 'audio reference' and connect the referenced clips.
  2. Or remove all @Audio tags from the prompt to run pure text-to-sound.
Defensive patterns

Strategy: validation

Validate before calling

from comfy_api_nodes.nodes_bytedance import max_audio_tag, MODE_TEXT
if mode == MODE_TEXT and max_audio_tag(text_prompt):
    raise ValueError("remove @Audio tags or switch mode to audio reference")

Type guard

def prompt_has_audio_tags(prompt: str) -> bool:
    return max_audio_tag(prompt) > 0

Prevention

When it happens

Trigger: Calling the audio generation node with mode='text only' while text_prompt contains '@Audio1' or higher (max_audio_tag returns > 0).

Common situations: Starting from an audio-reference template but leaving the mode widget on text only; hand-editing prompts that retain @Audio tags from an earlier workflow.

Related errors


AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14). Data as JSON: /api/errors/89440d44ea59afdb. Report an issue: GitHub.

Appendix: source

Thrown at comfy_api_nodes/nodes_bytedance.py:3159

        i
        for i in range(1, 3 + 1)
        if reference_mode.get(f"reference_audio_{i}") is not None
    ]


def validate_seed_audio_inputs(
    text_prompt: str,
    mode: str,
    audio_indices: list[int],
    has_image: bool,
    preset_voice: str | None = None,
) -> None:
    validate_string(text_prompt, field_name="text_prompt", min_length=1, max_length=3000)
    max_tag = max_audio_tag(text_prompt)

    if mode == MODE_TEXT:
        if max_tag:
            raise ValueError(
                f"The prompt references @Audio{max_tag}, but reference mode is '{MODE_TEXT}'. "
                f"Switch to '{MODE_AUDIO}' and connect the reference clip(s)."
            )
    elif mode == MODE_AUDIO:
        if not audio_indices:
            raise ValueError(
                f"Reference mode '{MODE_AUDIO}' requires at least one reference_audio input "
                f"(or switch to '{MODE_TEXT}')."
            )
        if audio_indices != list(range(1, len(audio_indices) + 1)):
            raise ValueError(
                "Connect reference_audio inputs in order without gaps: reference_audio_1, then _2, then _3."
            )
        if max_tag > len(audio_indices):
            raise ValueError(
                f"The prompt references @Audio{max_tag}, but only {len(audio_indices)} "
                f"reference audio(s) are connected."
            )

View on GitHub (pinned to 1c6d8d45b3)