Skip to content

fix(platform): map raw backend errors to ConvexError codes for actionable UI messages (#2056) - #2172

Merged
Israeltheminer merged 2 commits into
mainfrom
fix/convex-error-codes-2056
Jun 26, 2026
Merged

Israeltheminer merged 2 commits into
mainfrom
fix/convex-error-codes-2056

Conversation

@Israeltheminer

Copy link
Copy Markdown
Contributor

What & why

Convex redacts raw throw new Error(...) messages to "Server Error" in production. As a result, users hit unactionable failures, and clients that branched on error.message.includes(...) were silently dead in prod. This converts the expected-failure throws on three surfaces to ConvexError({ code }) and maps the codes to localized messages client-side.

Closes #2056.

Surfaces

[69] Knowledge-entry + website duplicate

  • KNOWLEDGE_ENTRY_DUPLICATE, WEBSITE_DUPLICATE_DOMAIN
  • Replaces the dead error.message.includes('already exists') check with convexErrorCode. Maps to the existing duplicate toast (no new i18n needed for this surface).

[30] Approval / human-input cards

  • Approvals: UNAUTHENTICATED, NOT_FOUND, ALREADY_RESOLVED, INVALID_DECISION
  • Human input: ALREADY_RESPONDED, NOT_EDITABLE, WORKFLOW_NOT_EDITABLE, GENERATION_IN_PROGRESS, INVALID_TYPE, NO_THREAD, BUDGET_EXCEEDED (carries a server-computed message)
  • New mapApprovalError / mapHumanInputError mappers; cards no longer surface the prod-redacted message.

[88] Automations triggers

  • UNAUTHENTICATED, INVALID_SLUG, NOT_INSTALLED, NOT_FOUND, APP_OWNED_WORKFLOW, INVALID_EVENT_TYPE, DUPLICATE_SUBSCRIPTION
  • New shared mapTriggerError; the event/schedule dialogs no longer collapse every failure to a single generic toast.

i18n

New error strings added to en / de / fr under approvalCommon, humanInputRequest, and automations.triggers.errors. de-CH inherits de.

Tests

Regression tests assert every code is thrown server-side and mapped client-side:

  • Backend (convex-test runs the real mutations end-to-end, proving ConvexError propagation): knowledge-entries, websites, approvals, human-input, automations-trigger.
  • Client: the duplicate dialogs (component tests) and the three error mappers (unit tests).

Local gate: server + ui + i18n suites green, tsc clean, oxlint clean, oxfmt clean, SAST 0 findings.

Note for reviewers

Approval/human-input failures are race-based (resolve in one tab, act in another). The duplicate cases ([69]) and duplicate event-trigger ([88]) are directly reproducible in the UI; see the test files for the exact conditions each code covers.

Israeltheminer and others added 2 commits June 26, 2026 20:41
…able UI messages (#2056)

Convex redacts raw `throw new Error(...)` messages to "Server Error" in
production, so users hit unactionable failures and clients that branched on
`error.message.includes(...)` were silently dead. Convert the expected-failure
throws on three surfaces to `ConvexError({ code })` and map the codes to
localized messages client-side.

Surfaces:
- [69] knowledge-entry + website duplicate: KNOWLEDGE_ENTRY_DUPLICATE,
  WEBSITE_DUPLICATE_DOMAIN. Replaces the dead `includes('already exists')`
  check with `convexErrorCode`.
- [30] approval / human-input cards: UNAUTHENTICATED, NOT_FOUND,
  ALREADY_RESOLVED, INVALID_DECISION (approvals) and ALREADY_RESPONDED,
  NOT_EDITABLE, WORKFLOW_NOT_EDITABLE, GENERATION_IN_PROGRESS, INVALID_TYPE,
  NO_THREAD, BUDGET_EXCEEDED (human input). New `mapApprovalError` /
  `mapHumanInputError` mappers.
- [88] automations triggers: UNAUTHENTICATED, INVALID_SLUG, NOT_INSTALLED,
  NOT_FOUND, APP_OWNED_WORKFLOW, INVALID_EVENT_TYPE, DUPLICATE_SUBSCRIPTION.
  New shared `mapTriggerError`; dialogs no longer collapse to a generic toast.

i18n added in en/de/fr (de-CH inherits de). Regression tests assert every code
is thrown server-side (convex-test runs the real mutations) and mapped
client-side.
@Israeltheminer
Israeltheminer merged commit af7af77 into main Jun 26, 2026
46 checks passed
@Israeltheminer
Israeltheminer deleted the fix/convex-error-codes-2056 branch June 26, 2026 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant