jamiepine/voicebox · error · ValueError
Profile {profile_id} not found
Error message
Profile {profile_id} not found What it means
Raised by add_profile_sample() when no DBVoiceProfile row matches the given profile_id. The lookup is an exact id match (filter_by(id=profile_id).first()); unlike name lookup it is not case-insensitive and does not fall back to name. Raised before any audio processing.
Source
Thrown at backend/services/profiles.py:222
db: Session,
) -> ProfileSampleResponse:
"""
Add a sample to a voice profile.
Args:
profile_id: Profile ID
audio_path: Path to temporary audio file
reference_text: Transcript of audio
db: Database session
Returns:
Created sample
"""
import asyncio
profile = db.query(DBVoiceProfile).filter_by(id=profile_id).first()
if not profile:
raise ValueError(f"Profile {profile_id} not found")
# Validate and load audio in a single pass, off the event loop
is_valid, error_msg, audio, sr = await asyncio.to_thread(
validate_and_load_reference_audio, audio_path
)
if not is_valid:
raise ValueError(f"Invalid reference audio: {error_msg}")
sample_id = str(uuid.uuid4())
profile_dir = config.get_profiles_dir() / profile_id
profile_dir.mkdir(parents=True, exist_ok=True)
dest_path = profile_dir / f"{sample_id}.wav"
await asyncio.to_thread(save_audio, audio, str(dest_path), sr)
db_sample = DBProfileSample(
id=sample_id,
profile_id=profile_id,View on GitHub (pinned to 51f49dea19)
Solutions
- Verify the profile exists (GET /profiles/{id}) before uploading a sample.
- Make sure you pass the profile's UUID id, not its display name — use get_profile_orm_by_name_or_id to resolve names.
- Re-seed or recreate the profile if the DB was reset.
Example fix
// before
add_profile_sample(profile_id="Morgan", ...)
// after - resolve name to id first
profile = get_profile_orm_by_name_or_id("Morgan", db)
if profile is None: raise
add_profile_sample(profile_id=profile.id, ...) Defensive patterns
Strategy: validation
Validate before calling
def profile_exists(profile_id: str, db) -> bool:
from ..database import VoiceProfile
return db.query(VoiceProfile).filter_by(id=profile_id).first() is not None
# resolve names to ids before calling add_profile_sample
profile = get_profile_orm_by_name_or_id(name_or_id, db)
if profile is None:
raise HTTPException(404, "profile not found")
sample = await add_profile_sample(profile.id, audio_path, ref_text, db) Type guard
def is_uuid_like(s: str) -> bool:
import uuid
try:
uuid.UUID(s); return True
except (ValueError, AttributeError, TypeError):
return False Try / catch
try:
await add_profile_sample(profile_id, audio_path, ref_text, db)
except ValueError as e:
if "not found" in str(e):
raise HTTPException(404, str(e))
raise Prevention
- Always pass the profile id (UUID), not the name, to add_profile_sample.
- Resolve names via get_profile_orm_by_name_or_id at the API boundary.
- GET the profile before upload to fail fast with a clear 404.
When it happens
Trigger: Calling add_profile_sample with a profile_id that was never created, was deleted, or is misspelled/truncated. Passing a profile name here instead of the UUID id will also fail.
Common situations: Client stored the profile name but passed it where the id is expected; using an id from a stale/local DB after the server DB was reset; race where the sample upload starts before the create transaction committed.
Related errors
- Invalid reference audio: {error_msg}
- Profile not found
- Voice profile '{data.profile}' not found.
- Profile {profile_id} not found
- Profile {profile_id} not found
AI-assisted analysis of jamiepine/voicebox@51f49dea19 (2026-08-12).
Data as JSON: /api/errors/b686cdf9848528bf.
Report an issue: GitHub.