Premium model denial shows a generic error instead of the upgrade message
Problem
When a user without premium sends with a premium model, the chat shows "An unexpected error occurred. Please try again." instead of the upgrade message. The same generic text is saved into the conversation. It's easy to hit: a user whose subscription ended keeps their saved premium model (e.g. GPT-5 Nano), so every send fails this way.
Repro
- Use an account with no
active/trialingsubscription whose saved model haspremium: true(e.g.gpt-5-nano). - Send a message.
- The reply is "An unexpected error occurred. Please try again."
Seen on the dev deployment while smoke-testing #84; the code involved is unchanged from main.
Cause
src/routes/api.chat.ts:522 throws new Error("PREMIUM_MODEL_ACCESS_DENIED"). classifyError in src/lib/error-utils.ts only reads codes from a ConvexError, so a plain Error falls through to SYSTEM_ERROR (generic message, HTTP 500). Both the HTTP response (createErrorResponse) and the saved conversation error (saveErrorMessage) go through it.
Expected
"This model requires a premium subscription. Please upgrade to access premium models." (getErrorMessage(ERROR_CODES.PREMIUM_MODEL_ACCESS_DENIED)), with that code's HTTP status.
Likely fix
Throw new ConvexError(ERROR_CODES.PREMIUM_MODEL_ACCESS_DENIED) instead, the form the scheduled-task path already uses.