jamiepine/voicebox · error · ValueError

Designed profiles require a design_prompt

Error message

Designed profiles require a design_prompt

What it means

Returned by _validate_profile_fields when voice_type=='designed' and design_prompt is missing or whitespace-only. A designed profile is defined by its text design_prompt, so an empty one leaves nothing to synthesize from.

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. Provide a non-empty design_prompt (e.g. 'warm female voice, calm pacing, slight British accent').
  2. Require a non-empty prompt in the UI before enabling submit when voice_type is 'designed'.
  3. If you have no design prompt, switch voice_type to 'cloned' or 'preset' instead.

Example fix

// before
{"name":"Narrator","voice_type":"designed","design_prompt":"   "}
// after
{"name":"Narrator","voice_type":"designed","design_prompt":"warm baritone, measured pace, neutral American accent"}
Defensive patterns

Strategy: validation

Validate before calling

def has_design_prompt(data) -> bool:
    return bool(data.design_prompt and data.design_prompt.strip())

if data.voice_type == "designed" and not has_design_prompt(data):
    raise HTTPException(400, "designed profiles require a non-empty design_prompt")

Type guard

def is_complete_designed(data) -> bool:
    p = getattr(data, "design_prompt", None)
    return getattr(data, "voice_type", None) == "designed" and bool(p and p.strip())

Prevention

When it happens

Trigger: POSTing {voice_type:'designed'} with design_prompt omitted, null, empty string, or only whitespace.

Common situations: Client lets the user pick 'designed' but the prompt textarea is empty; trimming the input to empty before submit; field renamed in the client so design_prompt never gets populated.

Related errors


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