Comfy-Org/ComfyUI · error · ValueError

The prompt references @Audio{idx}, but 'voice_{idx}' is set

Error message

The prompt references @Audio{idx}, but 'voice_{idx}' is set to 'none'.

What it means

During Grok @AudioN tag resolution, the referenced voice slot exists (1 <= idx <= len(voices)) but is set to 'none', meaning the user disabled that voice rather than disconnecting the slot. Because disabled voices are not mapped into audio_indices, the tag cannot be resolved and rewriting aborts. The error message names the exact slot, e.g. "voice_2 is set to 'none'".

Source

Thrown at comfy_api_nodes/nodes_grok.py:118

    stable so adjacent tags like '@Image1@Image2' all resolve."""
    audio_indices: dict[int, int] = {}
    for slot, voice in enumerate(voices, start=1):
        if voice != "none":
            audio_indices[slot] = len(audio_indices)

    def repl(match: re.Match) -> str:
        kind = match.group(1).lower()
        idx = int(match.group("idx") or 1)
        if kind == "image":
            if not 1 <= idx <= total_images:
                raise ValueError(
                    f"The prompt references @Image{idx}, but only {total_images} "
                    f"reference images are connected (a batched input counts once per image)."
                )
            return f"<IMAGE_{idx - 1}>"
        if idx not in audio_indices:
            if 1 <= idx <= len(voices):
                raise ValueError(f"The prompt references @Audio{idx}, but 'voice_{idx}' is set to 'none'.")
            raise ValueError(f"The prompt references @Audio{idx}, but only voices 1..{len(voices)} exist.")
        return f"<AUDIO_{audio_indices[idx]}>"

    prev = None
    while prev != prompt:
        prev = prompt
        prompt = _GROK_REF_TAG_RE.sub(repl, prompt)
    return prompt


def _extract_grok_price(response) -> float | None:
    if response.usage and response.usage.cost_in_usd_ticks is not None:
        return response.usage.cost_in_usd_ticks / 10_000_000_000
    return None


def _extract_grok_video_price(response) -> float | None:
    price = _extract_grok_price(response)

View on GitHub (pinned to 1c6d8d45b3)

Solutions

  1. Set voice_{idx} back to an actual voice instead of 'none'.
  2. Update the prompt to reference an active voice slot (one whose dropdown is not 'none').

Example fix

# before: voice_2 = 'none', prompt references it
prompt = "narrator: @Audio2 explains the scene"  # raises

# after: voice_2 = 'Charon'
prompt = "narrator: @Audio2 explains the scene"
Defensive patterns

Strategy: validation

Validate before calling

active = {slot for slot, v in enumerate(voices, start=1) if v != "none"}
refs = {int(m.group("idx") or 1) for m in _TAG.finditer(prompt) if m.group(1).lower() == "audio"}
muted = [i for i in refs if 1 <= i <= len(voices) and i not in active]
assert not muted, f"tags reference muted voices: {muted}"

Prevention

When it happens

Trigger: Prompt contains '@Audio2' while the voices list has at least 2 entries and voices[1] == 'none'. Slots set to 'none' between selected voices are otherwise harmless, but explicitly referenced ones are fatal.

Common situations: Reusing a prompt written when voice 2 was enabled, later muting that voice; permuting voice assignments and forgetting to update prompt tags; copying example prompts that assume all voice slots active.

Related errors


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