{"record":{"id":"91a79071e14b0735","repo":"jamiepine/voicebox","slug":"cloned-profiles-cannot-set-design-prompt","errorCode":null,"errorMessage":"Cloned profiles cannot set design_prompt","messagePattern":"Cloned profiles cannot set design_prompt","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"backend/services/profiles.py","lineNumber":173,"sourceCode":"    existing_profile = db.query(DBVoiceProfile).filter_by(name=data.name).first()\n    if existing_profile:\n        raise ValueError(f\"A profile with the name '{data.name}' already exists. Please choose a different name.\")\n\n    # Auto-set default_engine for preset profiles\n    default_engine = data.default_engine\n    voice_type = data.voice_type or \"cloned\"\n    if voice_type == \"preset\" and data.preset_engine and not default_engine:\n        default_engine = data.preset_engine\n\n    validation_error = _validate_profile_fields(\n        voice_type=voice_type,\n        preset_engine=data.preset_engine,\n        preset_voice_id=data.preset_voice_id,\n        design_prompt=data.design_prompt,\n        default_engine=default_engine,\n    )\n    if validation_error:\n        raise ValueError(validation_error)\n\n    db_profile = DBVoiceProfile(\n        id=str(uuid.uuid4()),\n        name=data.name,\n        description=data.description,\n        language=data.language,\n        voice_type=voice_type,\n        preset_engine=data.preset_engine,\n        preset_voice_id=data.preset_voice_id,\n        design_prompt=data.design_prompt,\n        default_engine=default_engine,\n        personality=data.personality,\n        created_at=datetime.utcnow(),\n        updated_at=datetime.utcnow(),\n    )\n\n    db.add(db_profile)\n    db.commit()","sourceCodeStart":155,"sourceCodeEnd":191,"githubUrl":"https://github.com/jamiepine/voicebox/blob/51f49dea198384b4eb6087b72c17057c6eb1c1cd/backend/services/profiles.py#L155-L191","documentation":"Returned by _validate_profile_fields for the cloned branch when design_prompt is set. design_prompt is exclusive to the 'designed' voice_type; a cloned profile is defined by its uploaded audio samples, not a text prompt.","triggerScenarios":"POSTing voice_type:'cloned' (or omitted) together with a non-null design_prompt.","commonSituations":"Reusing a designed-profile payload and changing voice_type to 'cloned' without clearing design_prompt; client sending a shared 'prompt' field mapped to design_prompt for every voice_type.","solutions":["If you want a prompt-defined voice, use voice_type:'designed'.","Otherwise remove design_prompt from the cloned-profile payload.","Split the client form so design_prompt is only present for designed profiles."],"exampleFix":"// before\n{\"name\":\"Echo\",\"voice_type\":\"cloned\",\"design_prompt\":\"deep voice\"}\n// after\n{\"name\":\"Echo\",\"voice_type\":\"cloned\"}","handlingStrategy":"validation","validationCode":"def cloned_has_no_design_prompt(data) -> bool:\n    vt = data.voice_type or \"cloned\"\n    return vt != \"cloned\" or not data.design_prompt\n\nif not cloned_has_no_design_prompt(data):\n    raise HTTPException(400, \"cloned profiles must not include design_prompt\")","typeGuard":"def is_clean_cloned_prompt(data) -> bool:\n    vt = getattr(data, \"voice_type\", None) or \"cloned\"\n    return vt != \"cloned\" or not getattr(data, \"design_prompt\", None)","tryCatchPattern":null,"preventionTips":["Map the UI 'prompt' field to design_prompt only when voice_type is 'designed'.","Do not send a shared prompt field for every voice_type.","Validate the cloned payload shape before submit."],"tags":["profiles","cloned","validation","create","mutually-exclusive"],"backgroundTag":null,"analyzedSha":"51f49dea198384b4eb6087b72c17057c6eb1c1cd","analyzedAt":"2026-08-12T16:51:42.824Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}