OpenChat icon indicating copy to clipboard operation
OpenChat copied to clipboard

Premium model denial shows a generic error instead of the upgrade message

Open ajanraj opened this issue 1 month ago • 0 comments

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

  1. Use an account with no active/trialing subscription whose saved model has premium: true (e.g. gpt-5-nano).
  2. Send a message.
  3. 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.

ajanraj avatar Oct 16 '26 15:10 ajanraj