{"record":{"id":"7ce3989da074c0ae","repo":"jamiepine/voicebox","slug":"no-voice-profiles-found-please-create-a-profile-b","errorCode":null,"errorMessage":"No voice profiles found. Please create a profile before importing generations.","messagePattern":"No voice profiles found\\. Please create a profile before importing generations\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"backend/services/export_import.py","lineNumber":406,"sourceCode":"            # Check if we should match an existing profile or create metadata\n            profile_id = None\n            profile_name = profile_data.get(\"name\", \"Unknown Profile\")\n            \n            # Try to find matching profile by name\n            if profile_name and profile_name != \"Unknown Profile\":\n                existing_profile = db.query(DBVoiceProfile).filter_by(name=profile_name).first()\n                if existing_profile:\n                    profile_id = existing_profile.id\n            \n            # If no matching profile, use a placeholder or the first available profile\n            if not profile_id:\n                # Get any profile, or None if no profiles exist\n                any_profile = db.query(DBVoiceProfile).first()\n                if any_profile:\n                    profile_id = any_profile.id\n                    profile_name = any_profile.name\n                else:\n                    raise ValueError(\"No voice profiles found. Please create a profile before importing generations.\")\n            \n            # Extract audio file to temporary location\n            with tempfile.NamedTemporaryFile(suffix=\".wav\", delete=False) as tmp:\n                tmp.write(zip_file.read(audio_file_path))\n                tmp_path = tmp.name\n            \n            try:\n                # Create generations directory\n                generations_dir = config.get_generations_dir()\n                generations_dir.mkdir(parents=True, exist_ok=True)\n                \n                # Generate new ID for this generation\n                new_generation_id = str(__import__('uuid').uuid4())\n                \n                # Copy audio to generations directory\n                audio_dest = generations_dir / f\"{new_generation_id}.wav\"\n                shutil.copy(tmp_path, audio_dest)\n                ","sourceCodeStart":388,"sourceCodeEnd":424,"githubUrl":"https://github.com/jamiepine/voicebox/blob/51f49dea198384b4eb6087b72c17057c6eb1c1cd/backend/services/export_import.py#L388-L424","documentation":"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.","triggerScenarios":"Fresh database with no voice profiles yet; all profiles were deleted; importing into a brand-new deployment before any profile has been created.","commonSituations":"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.","solutions":["Create at least one voice profile (clone a voice or add a preset) before importing generations.","If the manifest's profile.name should match an existing profile, verify the spelling — a mismatch sends the importer to the fallback path.","Confirm the DB session used by the import endpoint is the same one that has your profiles.","Optionally seed the target DB with the profile export first, then import generations."],"exampleFix":"# before: importing into an empty DB\nawait import_generation(zip_bytes, db)  # raises\n# after: create a profile first\nawait create_profile(VoiceProfileCreate(name='Host', language='en'), db)\nawait import_generation(zip_bytes, db)","handlingStrategy":"validation","validationCode":"def any_profile_exists(db) -> bool:\n    return db.query(DBVoiceProfile).first() is not None\n\n# before importing a generation:\nif not any_profile_exists(db):\n    raise HTTPException(409, 'Create at least one voice profile before importing generations.')","typeGuard":"null","tryCatchPattern":"try:\n    result = await import_generation_from_bytes(file_bytes, db)\nexcept ValueError as e:\n    if str(e).startswith('No voice profiles found'):\n        raise HTTPException(409, str(e))\n    raise HTTPException(400, str(e))","preventionTips":["Seed the target deployment with at least one profile before bulk-importing generations.","Import profiles first, then generations, when migrating.","Verify the DB session the importer uses actually points at the populated database."],"tags":["import","generation","profile","precondition","database"],"backgroundTag":null,"analyzedSha":"51f49dea198384b4eb6087b72c17057c6eb1c1cd","analyzedAt":"2026-08-12T16:51:42.824Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}