{"record":{"id":"eae6550b8913eff5","repo":"Comfy-Org/ComfyUI","slug":"number-of-speakers-cannot-be-specified-when-diariz","errorCode":null,"errorMessage":"Number of speakers cannot be specified when diarization is enabled. Either disable diarization or set num_speakers to 0.","messagePattern":"Number of speakers cannot be specified when diarization is enabled\\. Either disable diarization or set num_speakers to 0\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"comfy_api_nodes/nodes_elevenlabs.py","lineNumber":175,"sourceCode":"                IO.Hidden.unique_id,\n            ],\n            is_api_node=True,\n            price_badge=IO.PriceBadge(\n                expr=\"\"\"{\"type\":\"usd\",\"usd\":0.0073,\"format\":{\"approximate\":true,\"suffix\":\"/minute\"}}\"\"\",\n            ),\n        )\n\n    @classmethod\n    async def execute(\n        cls,\n        audio: Input.Audio,\n        model: dict,\n        language_code: str,\n        num_speakers: int,\n        seed: int,\n    ) -> IO.NodeOutput:\n        if model[\"diarize\"] and num_speakers:\n            raise ValueError(\n                \"Number of speakers cannot be specified when diarization is enabled. \"\n                \"Either disable diarization or set num_speakers to 0.\"\n            )\n        request = SpeechToTextRequest(\n            model_id=model[\"model\"],\n            cloud_storage_url=await upload_audio_to_comfyapi(\n                cls, audio, container_format=\"mp4\", codec_name=\"aac\", mime_type=\"audio/mp4\"\n            ),\n            language_code=language_code if language_code.strip() else None,\n            tag_audio_events=model[\"tag_audio_events\"],\n            num_speakers=num_speakers if num_speakers > 0 else None,\n            timestamps_granularity=model[\"timestamps_granularity\"],\n            diarize=model[\"diarize\"],\n            diarization_threshold=model[\"diarization_threshold\"] if model[\"diarize\"] else None,\n            seed=seed,\n            temperature=model[\"temperature\"],\n        )\n        response = await sync_op(","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/Comfy-Org/ComfyUI/blob/1c6d8d45b3693bfbb32385b410d813a7fd6be216/comfy_api_nodes/nodes_elevenlabs.py#L157-L193","documentation":"Raised by the ElevenLabs Speech-to-Text node when the workflow sets num_speakers to a non-zero value while the diarize toggle is on. The ElevenLabs API treats explicit speaker counting and automatic diarization as mutually exclusive configuration, and the node enforces this before building SpeechToTextRequest.","triggerScenarios":"model['diarize'] is true AND num_speakers > 0 on the ElevenLabsSpeechToText node.","commonSituations":"User knows the clip has 2 speakers and sets num_speakers=2 without noticing diarization is enabled by default; workflow shared between users with different toggle states.","solutions":["If you want automatic speaker detection: leave diarize on and set num_speakers to 0.","If you know the exact speaker count: disable diarize and keep num_speakers at that count.","Re-check both widgets after loading a shared workflow, since toggle defaults differ across versions."],"exampleFix":"// before: diarize=True, num_speakers=2\n// after:  diarize=True, num_speakers=0   // let the API detect speakers","handlingStrategy":"validation","validationCode":"def check_stt_config(diarize: bool, num_speakers: int) -> None:\n    if diarize and num_speakers:\n        raise ValueError(\"set num_speakers=0 when diarize is enabled\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat diarize and num_speakers as mutually exclusive in workflow templates.","Default num_speakers to 0 and let diarization detect, unless the count is known precisely."],"tags":["comfyui","elevenlabs","speech-to-text","validation","config-conflict"],"backgroundTag":null,"analyzedSha":"1c6d8d45b3693bfbb32385b410d813a7fd6be216","analyzedAt":"2026-08-14T19:37:18.893Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}