{"record":{"id":"61d31119c5bbae05","repo":"fishaudio/fish-speech","slug":"number-of-prompt-text-len-prompt-text-and-pro-61d311","errorCode":null,"errorMessage":"Number of prompt text ({len(prompt_text)}) and prompt audio ({len(prompt_audio)}) should be the same","messagePattern":"Number of prompt text \\((.+?)\\) and prompt audio \\((.+?)\\) should be the same","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"fish_speech/models/text2semantic/inference.py","lineNumber":871,"sourceCode":"    seed: int,\n    half: bool,\n    iterative_prompt: bool,\n    chunk_length: int,\n    output_dir: Path,\n) -> None:\n    os.makedirs(output_dir, exist_ok=True)\n    precision = torch.half if half else torch.bfloat16\n\n    if prompt_text and not prompt_audio and not prompt_tokens:\n        raise ValueError(\n            \"--prompt-text requires either --prompt-audio or --prompt-tokens\"\n        )\n    if prompt_text and prompt_tokens and len(prompt_text) != len(prompt_tokens):\n        raise ValueError(\n            f\"Number of prompt text ({len(prompt_text)}) and prompt tokens ({len(prompt_tokens)}) should be the same\"\n        )\n    if prompt_text and prompt_audio and len(prompt_text) != len(prompt_audio):\n        raise ValueError(\n            f\"Number of prompt text ({len(prompt_text)}) and prompt audio ({len(prompt_audio)}) should be the same\"\n        )\n\n    logger.info(\"Loading model ...\")\n    t0 = time.time()\n    model, decode_one_token = init_model(\n        checkpoint_path, device, precision, compile=compile\n    )\n    with torch.device(device):\n        model.setup_caches(\n            max_batch_size=1,\n            max_seq_len=model.config.max_seq_len,\n            dtype=next(model.parameters()).dtype,\n        )\n    if torch.cuda.is_available():\n        torch.cuda.synchronize()\n\n    logger.info(f\"Time to load model: {time.time() - t0:.02f} seconds\")","sourceCodeStart":853,"sourceCodeEnd":889,"githubUrl":"https://github.com/fishaudio/fish-speech/blob/befe4001745417f8c42131739d862b8a6fdbd15a/fish_speech/models/text2semantic/inference.py#L853-L889","documentation":"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.","triggerScenarios":"Calling inference.py with --prompt-text values whose count differs from the number of --prompt-audio files (e.g. 2 texts and 1 audio).","commonSituations":"Constructing a voice-cloning command by hand, or a wrapper script that appends an extra reference audio without a matching transcript.","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)"],"exampleFix":"# before\n--prompt-audio a.wav b.wav --prompt-text \"one\"\n# after\n--prompt-audio a.wav b.wav --prompt-text \"one\" \"two\"","handlingStrategy":"validation","validationCode":"assert len(prompt_text or []) == len(prompt_audio or []), f\"{len(prompt_text)} texts vs {len(prompt_audio)} audios\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build prompt pairs as zip(texts, audios) so they can never diverge","Validate lengths before invoking the CLI"],"tags":["input-validation","voice-cloning","cli"],"backgroundTag":"argument-count-mismatch","analyzedSha":"befe4001745417f8c42131739d862b8a6fdbd15a","analyzedAt":"2026-08-27T21:31:45.703Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}