jamiepine/voicebox · warning · HTTPException
{exception message from get_channel_voices (ValueError)}
Error message
{exception message from get_channel_voices (ValueError)} What it means
HTTP 400 branch in GET /channels/{channel_id}/voices that catches ValueError from channels.get_channel_voices(). In the current service implementation get_channel_voices() only queries the profile-channel mapping table and returns a list; it never raises ValueError. The catch is defensive scaffolding, so with the present code this 400 is effectively unreachable. A miss on the channel ID simply returns an empty profile_ids list (200), not a 404 and not this 400.
Source
Thrown at backend/routes/channels.py:84
success = await channels.delete_channel(channel_id, db)
if not success:
raise HTTPException(status_code=404, detail="Channel not found")
return {"message": "Channel deleted successfully"}
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))
@router.get("/channels/{channel_id}/voices")
async def get_channel_voices(
channel_id: str,
db: Session = Depends(get_db),
):
"""Get list of profile IDs assigned to a channel."""
try:
profile_ids = await channels.get_channel_voices(channel_id, db)
return {"profile_ids": profile_ids}
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))
@router.put("/channels/{channel_id}/voices")
async def set_channel_voices(
channel_id: str,
data: models.ChannelVoiceAssignment,
db: Session = Depends(get_db),
):
"""Set which voices are assigned to a channel."""
try:
await channels.set_channel_voices(channel_id, data, db)
return {"message": "Channel voices updated successfully"}
except ValueError as e:
raise HTTPException(status_code=400, detail=str(e))
View on GitHub (pinned to 51f49dea19)
Solutions
- Do not write client code expecting a 400 here; rely on the 200 + empty list semantics today.
- If you see this error, diff backend/services/channels.py for a new ValueError in get_channel_voices().
- Treat an empty profile_ids result as 'channel has no voices or channel is absent'.
Defensive patterns
Strategy: try-catch
Try / catch
const r = await fetch(`/channels/${id}/voices`);
if (r.status === 400) { /* not produced by current service; check for code drift */ } Prevention
- Do not write client code expecting a 400 from this endpoint today.
- Rely on 200 with possibly-empty profile_ids.
- If a 400 appears, diff the service for a new ValueError raise.
When it happens
Trigger: Not reachable with the current service code; would only fire if a future change to get_channel_voices() adds a ValueError raise (e.g. validating the channel exists).
Common situations: Encountering this in logs would indicate the service contract changed; otherwise callers should not expect it.
Related errors
- Channel not found
- {exception message from update_channel (ValueError)}
- {exception message from delete_channel (ValueError)}
- {exception message from set_channel_voices (ValueError)}
- HTTP error! status: ${response.status}
AI-assisted analysis of jamiepine/voicebox@51f49dea19 (2026-08-12).
Data as JSON: /api/errors/46ffedc95ef14e53.
Report an issue: GitHub.