RVC-Boss/GPT-SoVITS · error · RuntimeError

You input a wrong audio path that does not exists, please fi

Error message

You input a wrong audio path that does not exists, please fix it!

What it means

RuntimeError from load_audio(): after clean_path() strips stray quotes/spaces/newlines, the function checks os.path.exists(file) and rejects the call with an English message when the path still doesn't resolve. It is the first, specific stage of audio loading — the file simply isn't there (typo, wrong cwd, not yet downloaded).

Source

Thrown at tools/my_utils.py:23

import ffmpeg
import gradio as gr
import numpy as np
import pandas as pd

from tools.i18n.i18n import I18nAuto

i18n = I18nAuto(language=os.environ.get("language", "Auto"))


def load_audio(file, sr):
    try:
        # https://github.com/openai/whisper/blob/main/whisper/audio.py#L26
        # This launches a subprocess to decode audio while down-mixing and resampling as necessary.
        # Requires the ffmpeg CLI and `ffmpeg-python` package to be installed.
        file = clean_path(file)  # 防止小白拷路径头尾带了空格和"和回车
        if os.path.exists(file) is False:
            raise RuntimeError("You input a wrong audio path that does not exists, please fix it!")
        out, _ = (
            ffmpeg.input(file, threads=0)
            .output("-", format="f32le", acodec="pcm_f32le", ac=1, ar=sr)
            .run(cmd=["ffmpeg", "-nostdin"], capture_stdout=True, capture_stderr=True)
        )
    except Exception:
        out, _ = (
            ffmpeg.input(file, threads=0)
            .output("-", format="f32le", acodec="pcm_f32le", ac=1, ar=sr)
            .run(cmd=["ffmpeg", "-nostdin"], capture_stdout=True)
        )  # Expose the Error
        raise RuntimeError(i18n("音频加载失败"))

    return np.frombuffer(out, np.float32).flatten()


def clean_path(path_str: str):
    if path_str.endswith(("\\", "/")):

View on GitHub (pinned to d523079fc0)

Solutions

  1. Verify the exact path exists (paste it into ls); fix typos and use absolute paths.
  2. Regenerate the training file list after moving audio; or batch-validate all entries with os.path.exists before starting a long preprocessing job.
  3. Run the process from the directory the relative paths are relative to, or normalize with os.path.abspath.
  4. Download/restore the missing file if it comes from a remote dataset.

Example fix

# before
audio = load_audio("dataset/utt_0001.wav", 32000)  # RuntimeError: wrong audio path...

# after
import os
p = "dataset/utt_0001.wav"
assert os.path.exists(p), f"missing audio: {p} — fix list file or restore file"
audio = load_audio(p, 32000)
Defensive patterns

Strategy: validation

Validate before calling

import os
from tools.my_utils import clean_path
path = clean_path(user_path)
if not os.path.exists(os.path.abspath(path)):
    raise ValueError(f"audio file not found: {path!r}")
audio = load_audio(path, sr)

Type guard

def is_loadable_audio(path: str | None) -> bool:
    return bool(path) and os.path.exists(clean_path(path))

Prevention

When it happens

Trigger: Calling tools.my_utils.load_audio(file, sr) (used throughout training-data preparation and preprocessing) with a non-existent path — including paths that look fine but contain invisible characters or a wrong relative base.

Common situations: Training list .list files referencing moved/renamed wav files; relative paths resolved from a different cwd; trailing quote/space from copying a path out of a chat/browser (clean_path fixes common ones but not e.g. full-width or mid-string garbage); empty path from a bad CSV field.

Related errors


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