jamiepine/voicebox · error · HTTPException

{exception message from update_preset (ValueError)}

Error message

{exception message from update_preset (ValueError)}

What it means

HTTP 400 raised by PUT /effects/presets/{preset_id} when effects_mod.update_preset() raises ValueError. The service raises ValueError in two cases: the preset is built-in (is_builtin true -> 'Cannot modify built-in presets'), or the supplied effects_chain fails validate_effects_chain() (unknown type/out-of-range param, message passed through). The handler re-wraps the message into 400.

Source

Thrown at backend/routes/effects.py:122

        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))


@router.delete("/effects/presets/{preset_id}")
async def delete_effect_preset(preset_id: str, db: Session = Depends(get_db)):
    """Delete a user effect preset."""
    from ..services import effects as effects_mod

    try:
        if not effects_mod.delete_preset(preset_id, db):
            raise HTTPException(status_code=404, detail="Preset not found")
        return {"status": "deleted"}
    except ValueError as e:
        raise HTTPException(status_code=400, detail=str(e))


@router.get(
    "/generations/{generation_id}/versions",
    response_model=list[models.GenerationVersionResponse],

View on GitHub (pinned to 51f49dea19)

Solutions

  1. If the detail is 'Cannot modify built-in presets', target a user-created preset or create a new one.
  2. If the detail is a chain-validation message, fix the named effect/param per the validator.
  3. Disable edit controls for presets where is_builtin is true.
  4. Validate the chain client-side with the same rules before submitting.

Example fix

// before
await fetch(`/effects/presets/${id}`, { method:'PUT', body: JSON.stringify({ effects_chain }) });
// after
if (preset.is_builtin) { alert('Duplicate the built-in preset to edit it'); return; }
await fetch(`/effects/presets/${id}`, { method:'PUT', body: JSON.stringify({ effects_chain }) });
Defensive patterns

Strategy: validation

Validate before calling

if (preset.is_builtin) throw new Error('cannot modify built-in preset');
// plus run the same chain validation as error 94

Type guard

function isBuiltinPreset(p): p is { is_builtin: true } { return p?.is_builtin === true; }

Try / catch

const r = await fetch(`/effects/presets/${id}`, { method:'PUT', body: JSON.stringify(patch) });
if (r.status === 400) { const { detail } = await r.json(); /* 'Cannot modify built-in presets' or chain error */ }

Prevention

When it happens

Trigger: PUTting to a built-in preset, or supplying an effects_chain that violates the validator rules.

Common situations: Editing a shipped built-in preset instead of a user one; sending a chain with a typo'd effect name or out-of-range param; UI not disabling edit for built-ins.

Related errors


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