OpenBMB/VoxCPM · error · FileNotFoundError

prompt_wav_path does not exist: {prompt_wav_path}

Error message

prompt_wav_path does not exist: {prompt_wav_path}

What it means

Voice-cloning prompt audio path is checked with os.path.exists before inference; a missing file raises FileNotFoundError.

Source

Thrown at src/voxcpm/core.py:233

            normalize: Whether to run text normalization before generation.
            denoise: Whether to denoise the prompt/reference audio if a
                denoiser is available.
            retry_badcase: Whether to retry badcase.
            retry_badcase_max_times: Maximum number of times to retry badcase.
            retry_badcase_ratio_threshold: Threshold for audio-to-text ratio.
            streaming: Whether to return a generator of audio chunks.
            seed: Optional random seed for reproducibility.
        Returns:
            Generator of numpy.ndarray: 1D waveform array (float32) on CPU.
            Yields audio chunks for each generation step if ``streaming=True``,
            otherwise yields a single array containing the final audio.
        """
        if not isinstance(text, str) or not text.strip():
            raise ValueError("target text must be a non-empty string")

        if prompt_wav_path is not None:
            if not os.path.exists(prompt_wav_path):
                raise FileNotFoundError(f"prompt_wav_path does not exist: {prompt_wav_path}")

        if reference_wav_path is not None:
            if not os.path.exists(reference_wav_path):
                raise FileNotFoundError(f"reference_wav_path does not exist: {reference_wav_path}")

        if (prompt_wav_path is None) != (prompt_text is None):
            raise ValueError("prompt_wav_path and prompt_text must both be provided or both be None")

        is_v2 = isinstance(self.tts_model, VoxCPM2Model)
        if reference_wav_path is not None and not is_v2:
            raise ValueError("reference_wav_path is only supported with VoxCPM2 models")

        text = text.replace("\n", " ")
        text = re.sub(r"\s+", " ", text)
        temp_files = []

        try:
            actual_prompt_path = prompt_wav_path

View on GitHub (pinned to f5a1c6a6b9)

Solutions

  1. Verify/correct the path (use absolute paths)
  2. Ensure any uploaded/generated prompt wav is fully written before generate()
  3. Confirm the file extension/case matches on case-sensitive filesystems

Example fix

# before
model.generate(text, prompt_wav_path="ref/voice.WAV")
# after
from pathlib import Path
p = Path("ref/voice.wav").resolve()
assert p.exists(), p
model.generate(text, prompt_wav_path=str(p))
Defensive patterns

Strategy: validation

Validate before calling

from pathlib import Path
p = Path(prompt_wav_path).resolve()
if not p.is_file():
    raise FileNotFoundError(p)
prompt_wav_path = str(p)

Prevention

When it happens

Trigger: Calling generate(..., prompt_wav_path=...) where the wav file does not exist at that path at call time.

Common situations: Relative path resolved from a different CWD, uploaded file not yet written to disk, or prompt file deleted between runs.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of OpenBMB/VoxCPM@f5a1c6a6b9 (2026-08-27). Data as JSON: /api/errors/e8cb476984f9bfb9. Report an issue: GitHub.