OpenBMB/VoxCPM · error · FileNotFoundError

reference_wav_path does not exist: {reference_wav_path}

Error message

reference_wav_path does not exist: {reference_wav_path}

What it means

The VoxCPM2-only reference audio path is existence-checked in _generate; missing file raises FileNotFoundError.

Source

Thrown at src/voxcpm/core.py:237

            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
            actual_ref_path = reference_wav_path

            if denoise and self.denoiser is not None:
                if prompt_wav_path is not None:

View on GitHub (pinned to f5a1c6a6b9)

Solutions

  1. Verify the reference wav path exists and is readable
  2. Use absolute paths in configs
  3. Re-download/regenerate the reference audio if produced upstream

Example fix

# before
model.generate(text, reference_wav_path="/data/ref.wav")
# after
import os
ref = "/data/ref.wav"
if not os.path.exists(ref):
    raise FileNotFoundError(ref)
model.generate(text, reference_wav_path=ref)
Defensive patterns

Strategy: validation

Validate before calling

import os
if reference_wav_path and not os.path.isfile(reference_wav_path):
    raise FileNotFoundError(reference_wav_path)

Prevention

When it happens

Trigger: Calling generate with reference_wav_path pointing to a nonexistent file (only valid on VoxCPM2 models anyway).

Common situations: Same as prompt_wav_path: wrong CWD for relative paths, missing upload, or stale config referencing a deleted reference clip.

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/2cb5854e3a017f69. Report an issue: GitHub.