jamiepine/voicebox · error · ValueError

Sample audio not found for profile {profile_id}

Error message

Sample audio not found for profile {profile_id}

What it means

Raised in the single-sample path of create_voice_prompt_from_profile() when config.resolve_storage_path(sample.audio_path) returns None. This means the stored audio_path cannot be resolved to a real filesystem location — the underlying file is missing, the storage root is misconfigured, or the stored path is malformed. The function refuses to continue because there is no audio to feed to create_voice_prompt.

Source

Thrown at backend/services/profiles.py:585

            "design_prompt": profile.design_prompt,
        }

    if engine not in CLONING_ENGINES:
        raise ValueError(f"Engine '{engine}' does not support cloned voice profiles")

    # ── Cloned profiles: create from audio samples ──
    samples = db.query(DBProfileSample).filter_by(profile_id=profile_id).all()

    if not samples:
        raise ValueError(f"No samples found for profile {profile_id}")

    tts_model = get_tts_backend_for_engine(engine)

    if len(samples) == 1:
        sample = samples[0]
        sample_audio_path = config.resolve_storage_path(sample.audio_path)
        if sample_audio_path is None:
            raise ValueError(f"Sample audio not found for profile {profile_id}")
        voice_prompt, _ = await tts_model.create_voice_prompt(
            str(sample_audio_path),
            sample.reference_text,
            use_cache=use_cache,
        )
        return voice_prompt

    audio_paths = []
    for sample in samples:
        sample_audio_path = config.resolve_storage_path(sample.audio_path)
        if sample_audio_path is None:
            raise ValueError(f"Sample audio not found for profile {profile_id}")
        audio_paths.append(str(sample_audio_path))
    reference_texts = [s.reference_text for s in samples]

    combined_audio, combined_text = await tts_model.combine_voice_prompts(
        audio_paths,
        reference_texts,

View on GitHub (pinned to 51f49dea19)

Solutions

  1. Verify the audio file exists on disk at the resolved path and that STORAGE_ROOT is configured correctly.
  2. Re-upload the sample so a valid audio_path is stored and the file lands in the active storage root.
  3. If resolve_storage_path returns None due to a path format issue, normalize sample.audio_path to a storage-relative path.
  4. If files were migrated, run a script to reconcile DBProfileSample.audio_path values with the new storage layout.

Example fix

// before: sample.audio_path points to a file that no longer exists
// after: re-upload the sample, or fix the storage root
resolved = config.resolve_storage_path(sample.audio_path)
if resolved is None or not resolved.exists():
    raise HTTPException(409, f"Sample audio missing on disk for sample {sample.id}; re-upload required")
Defensive patterns

Strategy: validation

Validate before calling

from backend import config

def sample_audio_present(sample) -> bool:
    p = config.resolve_storage_path(sample.audio_path)
    return p is not None and p.exists()

for s in db.query(DBProfileSample).filter_by(profile_id=profile_id).all():
    if not sample_audio_present(s):
        raise HTTPException(409, f"Sample {s.id} audio missing on disk")

Try / catch

try:
    prompt = await create_voice_prompt_from_profile(profile_id, db, engine=engine)
except ValueError as e:
    if 'Sample audio not found' in str(e):
        raise HTTPException(409, str(e) + ' — re-upload required')
    raise

Prevention

When it happens

Trigger: The audio file referenced by DBProfileSample.audio_path was deleted from disk (manual cleanup, expired volume); STORAGE_ROOT config changed so resolve_storage_path can no longer locate the file; sample.audio_path stored as an absolute path that no longer exists; file migration that moved assets without updating DB rows.

Common situations: Docker volume remount losing uploads; backup restore of DB without restoring the file storage; NFS/object-storage sync lag; dev environment pointing STORAGE_ROOT at a dir missing the assets; CI test using a DB dump without the matching files.

Related errors


AI-assisted analysis of jamiepine/voicebox@51f49dea19 (2026-08-12). Data as JSON: /api/errors/11db0f91eb3821dd. Report an issue: GitHub.