jamiepine/voicebox · error · HTTPException
{exception message from create_preset (ValueError)}
Error message
{exception message from create_preset (ValueError)} What it means
HTTP 400 raised by POST /effects/presets when effects_mod.create_preset() raises ValueError. The service raises ValueError in two cases: the effects_chain fails validate_effects_chain() (unknown type/out-of-range param/etc., message passed through), or a preset with the given name already exists (checked before insert and again on IntegrityError). The handler re-wraps the message into 400.
Source
Thrown at backend/routes/effects.py:104
preset = effects_mod.get_preset(preset_id, db)
if not preset:
raise HTTPException(status_code=404, detail="Preset not found")
return preset
@router.post("/effects/presets", response_model=models.EffectPresetResponse)
async def create_effect_preset(
data: models.EffectPresetCreate,
db: Session = Depends(get_db),
):
"""Create a new effect preset."""
from ..services import effects as effects_mod
try:
return effects_mod.create_preset(data, db)
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))
@router.put("/effects/presets/{preset_id}", response_model=models.EffectPresetResponse)
async def update_effect_preset(
preset_id: str,
data: models.EffectPresetUpdate,
db: Session = Depends(get_db),
):
"""Update an effect preset."""
from ..services import effects as effects_mod
try:
result = effects_mod.update_preset(preset_id, data, db)
if not result:
raise HTTPException(status_code=404, detail="Preset not found")
return result
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))View on GitHub (pinned to 51f49dea19)
Solutions
- If the detail mentions 'already exists', pick a unique name or rename the conflicting preset first.
- If the detail is a chain-validation message, fix the offending effect/param per the validator rules.
- GET /effects/presets and check names client-side before submitting.
- Validate the chain with the same rules as validate_effects_chain before posting.
Example fix
// before
await fetch('/effects/presets', { method:'POST', body: JSON.stringify({ name, effects_chain }) });
// after
const presets = await fetch('/effects/presets').then(r => r.json());
if (presets.some(p => p.name === name)) { alert('Preset name already used'); return; }
await fetch('/effects/presets', { method:'POST', body: JSON.stringify({ name, effects_chain }) }); Defensive patterns
Strategy: validation
Validate before calling
const presets = await fetch('/effects/presets').then(r => r.json());
if (presets.some(p => p.name === name)) throw new Error('preset name already used');
// plus run the same chain validation as error 94 Type guard
function isUniquePresetName(name, presets): boolean { return !presets.some(p => p.name === name); } Try / catch
const r = await fetch('/effects/presets', { method:'POST', body: JSON.stringify(data) });
if (r.status === 400) { const { detail } = await r.json(); /* 'already exists' or chain error */ } Prevention
- Check name uniqueness against the live presets list.
- Validate the chain client-side before creating.
- Pick descriptive unique names to avoid collisions.
When it happens
Trigger: Creating a preset whose effects_chain is invalid, or whose name duplicates an existing preset (built-in or user).
Common situations: Naming a new preset the same as an existing one; shipping a chain config built for an older effect registry; re-running a create after it partially succeeded.
Related errors
- {exception message from update_preset (ValueError)}
- {exception message from update_channel (ValueError)}
- {exception message from delete_channel (ValueError)}
- Generation is not completed
- {validation error from validate_effects_chain}
AI-assisted analysis of jamiepine/voicebox@51f49dea19 (2026-08-12).
Data as JSON: /api/errors/6c2f9bf3faac0a85.
Report an issue: GitHub.