Skip to content

Bug: Duplicate username during signup causes unhandled 500 error #251

@ChaitanyaChute

Description

@ChaitanyaChute

Description

The signup flow only checks for duplicate email addresses before creating a user account, even though the username field is marked as unique in the database schema.

As a result, attempting to register with an existing username triggers a database unique constraint error that is not handled properly, causing the API to return a 500 Internal Server Error.

Expected Behavior

  • Signup should validate both email and username uniqueness before user creation.
  • If the username already exists, the API should return a proper client error (e.g. 409 Conflict or 400 Bad Request) with a clear message.

Current Behavior

  • Duplicate email is handled correctly.
  • Duplicate username triggers a database exception.
  • API responds with 500 Internal Server Error.

Suggested Fix

*Validate username uniqueness before creating the user.
*Additionally, handle database unique constraint errors gracefully as a fallback.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions