Error shapes
The three error envelopes Lunar API can return and which parts of the system emit each one.
Error shapes
Lunar API emits three distinct error envelopes. Treat all three as possible when calling any endpoint.
1. Validation envelope
{ "error": "..." }Emitted by the auth controller for input validation and messages like Invalid credentials, User is banned, and Username already exists.
2. Status + message envelope
{ "status": 401, "message": "..." }Emitted by the auth middleware, the S3 admin handlers, and every admin role check.
3. Exception envelope
{ "message": "...", "stack": "..." }Returned for unmatched routes and unhandled exceptions. stack is "N/A" in production.