jamiepine/voicebox · error · ValueError

No voice profiles found. Please create a profile before impo

Error message

No voice profiles found. Please create a profile before importing generations.

What it means

Raised during generation import when the manifest's profile name does not match an existing profile AND db.query(DBVoiceProfile).first() returns None (export_import.py:399-406). A generation must be assigned to a profile, and the importer refuses to fabricate one — it requires at least one profile to exist as the assignee.

Source

Thrown at backend/services/export_import.py:406

            # Check if we should match an existing profile or create metadata
            profile_id = None
            profile_name = profile_data.get("name", "Unknown Profile")
            
            # Try to find matching profile by name
            if profile_name and profile_name != "Unknown Profile":
                existing_profile = db.query(DBVoiceProfile).filter_by(name=profile_name).first()
                if existing_profile:
                    profile_id = existing_profile.id
            
            # If no matching profile, use a placeholder or the first available profile
            if not profile_id:
                # Get any profile, or None if no profiles exist
                any_profile = db.query(DBVoiceProfile).first()
                if any_profile:
                    profile_id = any_profile.id
                    profile_name = any_profile.name
                else:
                    raise ValueError("No voice profiles found. Please create a profile before importing generations.")
            
            # Extract audio file to temporary location
            with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as tmp:
                tmp.write(zip_file.read(audio_file_path))
                tmp_path = tmp.name
            
            try:
                # Create generations directory
                generations_dir = config.get_generations_dir()
                generations_dir.mkdir(parents=True, exist_ok=True)
                
                # Generate new ID for this generation
                new_generation_id = str(__import__('uuid').uuid4())
                
                # Copy audio to generations directory
                audio_dest = generations_dir / f"{new_generation_id}.wav"
                shutil.copy(tmp_path, audio_dest)
                

View on GitHub (pinned to 51f49dea19)

Solutions

  1. Create at least one voice profile (clone a voice or add a preset) before importing generations.
  2. If the manifest's profile.name should match an existing profile, verify the spelling — a mismatch sends the importer to the fallback path.
  3. Confirm the DB session used by the import endpoint is the same one that has your profiles.
  4. Optionally seed the target DB with the profile export first, then import generations.

Example fix

# before: importing into an empty DB
await import_generation(zip_bytes, db)  # raises
# after: create a profile first
await create_profile(VoiceProfileCreate(name='Host', language='en'), db)
await import_generation(zip_bytes, db)
Defensive patterns

Strategy: validation

Validate before calling

def any_profile_exists(db) -> bool:
    return db.query(DBVoiceProfile).first() is not None

# before importing a generation:
if not any_profile_exists(db):
    raise HTTPException(409, 'Create at least one voice profile before importing generations.')

Type guard

null

Try / catch

try:
    result = await import_generation_from_bytes(file_bytes, db)
except ValueError as e:
    if str(e).startswith('No voice profiles found'):
        raise HTTPException(409, str(e))
    raise HTTPException(400, str(e))

Prevention

When it happens

Trigger: Fresh database with no voice profiles yet; all profiles were deleted; importing into a brand-new deployment before any profile has been created.

Common situations: New install where the user is importing generations before creating a profile; multi-tenant mix-up pointing at an empty tenant DB; profiles exist in a different DB than the one the import session holds.

Related errors


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