RVC-Boss/GPT-SoVITS · error · NO_PROMPT_ERROR

prompt_text cannot be empty when using SoVITS_V3

Error message

prompt_text cannot be empty when using SoVITS_V3

What it means

Raised as NO_PROMPT_ERROR when the inference call has no prompt text while the loaded model is SoVITS v2-Pro (configs.use_vocoder is True). The v2Pro vocoder path conditions generation on prompt text tokens; without them the vocoder has no linguistic anchor for the reference, so inference is refused rather than allowed to produce garbage.

Solutions

  1. Supply the transcript of the reference audio as prompt_text (and matching prompt_lang) whenever a v2Pro/vocoder model is loaded.
  2. If you must run without prompt text, switch back to a non-Pro sovits model (v1/v2/v3/v4 checkpoint without the Pro vocoder path).
  3. In API wrappers, make prompt_text a required field when configs.use_vocoder is True and validate before dispatch.

Example fix

# before
audio = handler.run(text="你好", text_lang="zh", ref_audio_path="ref.wav")  # NO_PROMPT_ERROR

# after
audio = handler.run(
    text="你好", text_lang="zh",
    ref_audio_path="ref.wav",
    prompt_text="这是参考音频的文字内容", prompt_lang="zh",  # required for v2Pro
)
Defensive patterns

Strategy: validation

Validate before calling

if handler.configs.use_vocoder and not (prompt_text or "").strip():
    raise ValueError("prompt_text is required for SoVITS v2Pro models")

Type guard

def requires_prompt_text(handler) -> bool:
    """v2Pro/vocoder models cannot run without the reference transcript."""
    return bool(getattr(handler.configs, "use_vocoder", False))

Prevention

When it happens

Trigger: Calling infer_batch (or the TTS.run wrapper) with prompt_text=None or "" while configs.use_vocoder is True — i.e. a v2Pro sovits model is loaded and the caller tries the 'ref_free' (no prompt text) mode that works for v1/v2.

Common situations: User upgrades to a v2Pro model but keeps an old script/preset that omitted prompt text; webui opened in free-reference mode with a Pro model selected; API request built without prompt_text field.

Related errors


AI-assisted analysis of RVC-Boss/GPT-SoVITS@d523079fc0 (2026-08-15). Data as JSON: /api/errors/3a63d4459dfa4dc0. Report an issue: GitHub.

Appendix: source

Thrown at GPT_SoVITS/TTS_infer_pack/TTS.py:1120

            print(i18n("当开启并行推理模式时,SoVits V3/4模型不支持分桶处理,已自动关闭分桶处理"))
            split_bucket = False
        else:
            print(i18n("分桶处理模式已关闭"))

        # if fragment_interval < 0.01:
        #     fragment_interval = 0.01
        #     print(i18n("分段间隔过小,已自动设置为0.01"))

        no_prompt_text = False
        if prompt_text in [None, ""]:
            no_prompt_text = True

        assert text_lang in self.configs.languages
        if not no_prompt_text:
            assert prompt_lang in self.configs.languages

        if no_prompt_text and self.configs.use_vocoder:
            raise NO_PROMPT_ERROR("prompt_text cannot be empty when using SoVITS_V3")

        if ref_audio_path in [None, ""] and (
            (self.prompt_cache["prompt_semantic"] is None) or (self.prompt_cache["refer_spec"] in [None, []])
        ):
            raise ValueError(
                "ref_audio_path cannot be empty, when the reference audio is not set using set_ref_audio()"
            )

        ###### setting reference audio and prompt text preprocessing ########
        t0 = time.perf_counter()
        if (ref_audio_path is not None) and (
            ref_audio_path != self.prompt_cache["ref_audio_path"]
            or (self.is_v2pro and self.prompt_cache["refer_spec"][0][1] is None)
        ):
            if not os.path.exists(ref_audio_path):
                raise ValueError(f"{ref_audio_path} not exists")
            self.set_ref_audio(ref_audio_path)

View on GitHub (pinned to d523079fc0)