{"record":{"id":"f45b3da74e287cd4","repo":"Comfy-Org/ComfyUI","slug":"the-prompt-references-audio-idx-but-voice-idx","errorCode":null,"errorMessage":"The prompt references @Audio{idx}, but 'voice_{idx}' is set to 'none'.","messagePattern":"The prompt references @Audio(.+?), but 'voice_(.+?)' is set to 'none'\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_grok.py","lineNumber":118,"sourceCode":"    stable so adjacent tags like '@Image1@Image2' all resolve.\"\"\"\n    audio_indices: dict[int, int] = {}\n    for slot, voice in enumerate(voices, start=1):\n        if voice != \"none\":\n            audio_indices[slot] = len(audio_indices)\n\n    def repl(match: re.Match) -> str:\n        kind = match.group(1).lower()\n        idx = int(match.group(\"idx\") or 1)\n        if kind == \"image\":\n            if not 1 <= idx <= total_images:\n                raise ValueError(\n                    f\"The prompt references @Image{idx}, but only {total_images} \"\n                    f\"reference images are connected (a batched input counts once per image).\"\n                )\n            return f\"<IMAGE_{idx - 1}>\"\n        if idx not in audio_indices:\n            if 1 <= idx <= len(voices):\n                raise ValueError(f\"The prompt references @Audio{idx}, but 'voice_{idx}' is set to 'none'.\")\n            raise ValueError(f\"The prompt references @Audio{idx}, but only voices 1..{len(voices)} exist.\")\n        return f\"<AUDIO_{audio_indices[idx]}>\"\n\n    prev = None\n    while prev != prompt:\n        prev = prompt\n        prompt = _GROK_REF_TAG_RE.sub(repl, prompt)\n    return prompt\n\n\ndef _extract_grok_price(response) -> float | None:\n    if response.usage and response.usage.cost_in_usd_ticks is not None:\n        return response.usage.cost_in_usd_ticks / 10_000_000_000\n    return None\n\n\ndef _extract_grok_video_price(response) -> float | None:\n    price = _extract_grok_price(response)","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_grok.py#L100-L136","documentation":"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'\".","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set voice_{idx} back to an actual voice instead of 'none'.","Update the prompt to reference an active voice slot (one whose dropdown is not 'none')."],"exampleFix":"# before: voice_2 = 'none', prompt references it\nprompt = \"narrator: @Audio2 explains the scene\"  # raises\n\n# after: voice_2 = 'Charon'\nprompt = \"narrator: @Audio2 explains the scene\"","handlingStrategy":"validation","validationCode":"active = {slot for slot, v in enumerate(voices, start=1) if v != \"none\"}\nrefs = {int(m.group(\"idx\") or 1) for m in _TAG.finditer(prompt) if m.group(1).lower() == \"audio\"}\nmuted = [i for i in refs if 1 <= i <= len(voices) and i not in active]\nassert not muted, f\"tags reference muted voices: {muted}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When muting a voice, grep the prompt for @Audio{slot} and update it.","Keep voice slot assignments stable once a prompt references them.","Validate tags against the live voices list before submit."],"tags":["grok","xai","prompt-template","audio","input-validation","comfy-api-nodes"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}