fishaudio/fish-speech · error · ValueError
Number of prompt text ({len(prompt_text)}) and prompt audio
Error message
Number of prompt text ({len(prompt_text)}) and prompt audio ({len(prompt_audio)}) should be the same What it means
Raised by the text2semantic inference CLI when the number of prompt texts and prompt audio files passed for voice cloning differ. The model pairs each reference text with its corresponding reference audio, so the lists must have equal length.
Source
Thrown at fish_speech/models/text2semantic/inference.py:871
seed: int,
half: bool,
iterative_prompt: bool,
chunk_length: int,
output_dir: Path,
) -> None:
os.makedirs(output_dir, exist_ok=True)
precision = torch.half if half else torch.bfloat16
if prompt_text and not prompt_audio and not prompt_tokens:
raise ValueError(
"--prompt-text requires either --prompt-audio or --prompt-tokens"
)
if prompt_text and prompt_tokens and len(prompt_text) != len(prompt_tokens):
raise ValueError(
f"Number of prompt text ({len(prompt_text)}) and prompt tokens ({len(prompt_tokens)}) should be the same"
)
if prompt_text and prompt_audio and len(prompt_text) != len(prompt_audio):
raise ValueError(
f"Number of prompt text ({len(prompt_text)}) and prompt audio ({len(prompt_audio)}) should be the same"
)
logger.info("Loading model ...")
t0 = time.time()
model, decode_one_token = init_model(
checkpoint_path, device, precision, compile=compile
)
with torch.device(device):
model.setup_caches(
max_batch_size=1,
max_seq_len=model.config.max_seq_len,
dtype=next(model.parameters()).dtype,
)
if torch.cuda.is_available():
torch.cuda.synchronize()
logger.info(f"Time to load model: {time.time() - t0:.02f} seconds")View on GitHub (pinned to befe400174)
Solutions
- Count --prompt-text and --prompt-audio arguments and make them equal (1:1 pairing, in the same order)
- Omit both to synthesize without voice cloning
- Ensure empty strings are not accidentally passed as extra entries (e.g. trailing commas in shell vars)
Example fix
# before --prompt-audio a.wav b.wav --prompt-text "one" # after --prompt-audio a.wav b.wav --prompt-text "one" "two"
Defensive patterns
Strategy: validation
Validate before calling
assert len(prompt_text or []) == len(prompt_audio or []), f"{len(prompt_text)} texts vs {len(prompt_audio)} audios" Prevention
- Build prompt pairs as zip(texts, audios) so they can never diverge
- Validate lengths before invoking the CLI
When it happens
Trigger: Calling inference.py with --prompt-text values whose count differs from the number of --prompt-audio files (e.g. 2 texts and 1 audio).
Common situations: Constructing a voice-cloning command by hand, or a wrapper script that appends an extra reference audio without a matching transcript.
Related errors
- Directory {path} does not exist.
- --reference_audio and --reference_text must be given the sam
- Reference audio file not found: {ref_audio}
- Invalid quantization mode {mode} needs to be one of [int8, i
- Text is too long, max length is {app_state.max_text_length}
AI-assisted analysis of fishaudio/fish-speech@befe400174 (2026-08-27).
Data as JSON: /api/errors/61d31119c5bbae05.
Report an issue: GitHub.