Pre-checks
Deployment Method
Source code
Steps to Reproduce
- Complete initial setup (first admin user created successfully)
- Register a second user at
/api/auth/register
- If any database constraint is violated (e.g. duplicate email), the response is a raw 500 error instead of a proper JSON error
Expected vs Actual Behavior
Expected: A 409 Conflict JSON response with a clear error message.
Actual: A raw 500 Internal Server Error with no JSON body. The frontend shows a generic "Request failed" message.
Root Cause
In backend/app/api/auth.py, db.commit() is only called explicitly in the first-user (admin) registration path. For subsequent users, the commit is deferred to the get_db() dependency cleanup. If that deferred commit hits an IntegrityError, FastAPI cannot catch it and returns a raw 500.
Logs / Screenshots
No response