Comfy-Org/ComfyUI · error · ValueError
Number of speakers cannot be specified when diarization is e
Error message
Number of speakers cannot be specified when diarization is enabled. Either disable diarization or set num_speakers to 0.
What it means
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.
Source
Thrown at comfy_api_nodes/nodes_elevenlabs.py:175
IO.Hidden.unique_id,
],
is_api_node=True,
price_badge=IO.PriceBadge(
expr="""{"type":"usd","usd":0.0073,"format":{"approximate":true,"suffix":"/minute"}}""",
),
)
@classmethod
async def execute(
cls,
audio: Input.Audio,
model: dict,
language_code: str,
num_speakers: int,
seed: int,
) -> IO.NodeOutput:
if model["diarize"] and num_speakers:
raise ValueError(
"Number of speakers cannot be specified when diarization is enabled. "
"Either disable diarization or set num_speakers to 0."
)
request = SpeechToTextRequest(
model_id=model["model"],
cloud_storage_url=await upload_audio_to_comfyapi(
cls, audio, container_format="mp4", codec_name="aac", mime_type="audio/mp4"
),
language_code=language_code if language_code.strip() else None,
tag_audio_events=model["tag_audio_events"],
num_speakers=num_speakers if num_speakers > 0 else None,
timestamps_granularity=model["timestamps_granularity"],
diarize=model["diarize"],
diarization_threshold=model["diarization_threshold"] if model["diarize"] else None,
seed=seed,
temperature=model["temperature"],
)
response = await sync_op(View on GitHub (pinned to 1c6d8d45b3)
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.
Example fix
// before: diarize=True, num_speakers=2 // after: diarize=True, num_speakers=0 // let the API detect speakers
Defensive patterns
Strategy: validation
Validate before calling
def check_stt_config(diarize: bool, num_speakers: int) -> None:
if diarize and num_speakers:
raise ValueError("set num_speakers=0 when diarize is enabled") Prevention
- 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.
When it happens
Trigger: model['diarize'] is true AND num_speakers > 0 on the ElevenLabsSpeechToText node.
Common situations: 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.
Related errors
- Unknown voice: {voice}
- INVALID_TAG_FILTER
- Connect at least one keyframe image.
- Spreading {len(images)} images across the clip needs an expl
- One of prompt or structured_prompt is required to be non-emp
AI-assisted analysis of Comfy-Org/ComfyUI@1c6d8d45b3 (2026-08-14).
Data as JSON: /api/errors/eae6550b8913eff5.
Report an issue: GitHub.