jamiepine/voicebox · error · ValueError

Cloned profiles cannot set design_prompt

Error message

Cloned profiles cannot set design_prompt

What it means

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.

Source

Thrown at backend/services/profiles.py:173

    existing_profile = db.query(DBVoiceProfile).filter_by(name=data.name).first()
    if existing_profile:
        raise ValueError(f"A profile with the name '{data.name}' already exists. Please choose a different name.")

    # Auto-set default_engine for preset profiles
    default_engine = data.default_engine
    voice_type = data.voice_type or "cloned"
    if voice_type == "preset" and data.preset_engine and not default_engine:
        default_engine = data.preset_engine

    validation_error = _validate_profile_fields(
        voice_type=voice_type,
        preset_engine=data.preset_engine,
        preset_voice_id=data.preset_voice_id,
        design_prompt=data.design_prompt,
        default_engine=default_engine,
    )
    if validation_error:
        raise ValueError(validation_error)

    db_profile = DBVoiceProfile(
        id=str(uuid.uuid4()),
        name=data.name,
        description=data.description,
        language=data.language,
        voice_type=voice_type,
        preset_engine=data.preset_engine,
        preset_voice_id=data.preset_voice_id,
        design_prompt=data.design_prompt,
        default_engine=default_engine,
        personality=data.personality,
        created_at=datetime.utcnow(),
        updated_at=datetime.utcnow(),
    )

    db.add(db_profile)
    db.commit()

View on GitHub (pinned to 51f49dea19)

Solutions

  1. If you want a prompt-defined voice, use voice_type:'designed'.
  2. Otherwise remove design_prompt from the cloned-profile payload.
  3. Split the client form so design_prompt is only present for designed profiles.

Example fix

// before
{"name":"Echo","voice_type":"cloned","design_prompt":"deep voice"}
// after
{"name":"Echo","voice_type":"cloned"}
Defensive patterns

Strategy: validation

Validate before calling

def cloned_has_no_design_prompt(data) -> bool:
    vt = data.voice_type or "cloned"
    return vt != "cloned" or not data.design_prompt

if not cloned_has_no_design_prompt(data):
    raise HTTPException(400, "cloned profiles must not include design_prompt")

Type guard

def is_clean_cloned_prompt(data) -> bool:
    vt = getattr(data, "voice_type", None) or "cloned"
    return vt != "cloned" or not getattr(data, "design_prompt", None)

Prevention

When it happens

Trigger: POSTing voice_type:'cloned' (or omitted) together with a non-null design_prompt.

Common situations: 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.

Related errors


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