jamiepine/voicebox · error · ValueError
Preset voice '{preset_voice_id}' is not valid for engine '{p
Error message
Preset voice '{preset_voice_id}' is not valid for engine '{preset_engine}' What it means
Returned by _validate_profile_fields when voice_type=='preset' and preset_voice_id is not in the known voice set for preset_engine. Only engines 'kokoro' (KOKORO_VOICES) and 'qwen_custom_voice' (QWEN_CUSTOM_VOICES) publish voice lists; for any other preset_engine the set is empty and this check is skipped, so this error only fires for those two engines.
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
- Fetch the live voice list for the engine (KOKORO_VOICES / QWEN_CUSTOM_VOICES) and select a valid preset_voice_id from it.
- Upgrade the backend so the voice catalogue matches what the client expects, then re-send.
- Regenerate the client's voice picker from the current backend response, not a cached snapshot.
Example fix
// before
{"voice_type":"preset","preset_engine":"kokoro","preset_voice_id":"af_heart_x"}
// after - use a real kokoro voice id
{"voice_type":"preset","preset_engine":"kokoro","preset_voice_id":"af_heart"} Defensive patterns
Strategy: validation
Validate before calling
from ..backends.kokoro_backend import KOKORO_VOICES
from ..backends.qwen_custom_voice_backend import QWEN_CUSTOM_VOICES
def known_voice_ids(engine: str) -> set[str]:
if engine == "kokoro":
return {v for v, *_ in KOKORO_VOICES}
if engine == "qwen_custom_voice":
return {v for v, *_ in QWEN_CUSTOM_VOICES}
return set() # other engines: catalogue not enforced
def preset_voice_ok(engine: str, voice_id: str) -> bool:
ids = known_voice_ids(engine)
return (not ids) or (voice_id in ids) Type guard
def is_known_preset_voice(engine: str, voice_id: str) -> bool:
ids = known_voice_ids(engine)
return not ids or voice_id in ids Prevention
- Populate the voice picker from the live KOKORO_VOICES / QWEN_CUSTOM_VOICES rather than a hardcoded list.
- Pin the backend version so the voice catalogue doesn't drift under your client.
- On backend upgrade, diff the voice catalogue and update any stored preset profiles whose ids disappeared.
When it happens
Trigger: POSTing preset_engine:'kokoro' with a voice id not in KOKORO_VOICES, or preset_engine:'qwen_custom_voice' with an id not in QWEN_CUSTOM_VOICES. A typo, a stale id from an older backend version, or an id belonging to a different engine.
Common situations: Hardcoding a voice id that was renamed/removed in a backend update; mixing up ids across engines (e.g. sending a kokoro id under qwen_custom_voice); frontend dropdown populated from a cached/stale list.
Related errors
- Preset profiles require both preset_engine and preset_voice_
- Preset profiles must use their preset_engine as default_engi
- A profile with the name '{data.name}' already exists. Please
- Designed profiles require a design_prompt
- Designed profiles cannot set preset_engine or preset_voice_i
AI-assisted analysis of jamiepine/voicebox@51f49dea19 (2026-08-12).
Data as JSON: /api/errors/2ae032af1c915c88.
Report an issue: GitHub.