Skip to content

fix: use ConvexError for client-facing publish errors#187

Merged
juhgiyo merged 1 commit into
mainfrom
claude/use-convex-error-for-client-facing-publish-errors
Apr 10, 2026
Merged

fix: use ConvexError for client-facing publish errors#187
juhgiyo merged 1 commit into
mainfrom
claude/use-convex-error-for-client-facing-publish-errors

Conversation

@juhgiyo

@juhgiyo juhgiyo commented Apr 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Bug fix: Convex strips plain Error messages from client-facing mutations as a security feature, so the improved error messages from PR fix: improve publish dependency error messages #186 were invisible to web UI users (they saw generic "Server Error" instead)
  • Changed 8 throw new Error()throw new ConvexError() in convex/roles.ts: the throwIfDepErrors helper and all error throws in the publish mutation (auth, ownership, deletion, version checks)
  • publishInternal (internal mutation) left unchanged — its errors are caught by the httpAction which accesses e.message directly

Test plan

  • 266/266 tests pass
  • TypeScript compiles cleanly (tsc --noEmit)
  • Verified ConvexError(string).message === string (httpAction catch blocks still work)
  • Manual: publish a role with a missing dependency via web UI → should see the full error message instead of "Server Error"

Follow-up (out of scope)

  • softDelete and restore mutations in convex/roles.ts have the same bug (plain Error in client-facing mutations)
  • convex/skills.ts, convex/agents.ts, convex/integrations.ts, convex/memories.ts have the same pattern

🤖 Generated with Claude Code

Convex strips plain Error messages from client-facing mutations as a
security feature. The improved error messages from PR #186 were invisible
to web UI users because throwIfDepErrors and the publish mutation used
throw new Error(). Changed to throw new ConvexError() so messages pass
through to the client. The CLI path (httpAction -> publishInternal) is
unaffected since httpAction catches e.message which works for both types.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Apr 10, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
strawhub Ready Ready Preview, Comment Apr 10, 2026 6:02pm

@juhgiyo juhgiyo merged commit f2fae2a into main Apr 10, 2026
7 checks passed
@juhgiyo juhgiyo deleted the claude/use-convex-error-for-client-facing-publish-errors branch April 10, 2026 18:22
juhgiyo added a commit that referenced this pull request Apr 11, 2026
… errors

Convex strips plain Error messages from client-facing mutations as a
security feature — only ConvexError passes through to the web UI client.
This change mirrors PR #187's fix for roles.ts:

- Add ConvexError import from convex/values
- Add throwIfDepErrors helper with actionable messages (includes skill
  slug, missing dependency names, and fix suggestions)
- Change all throw new Error() to throw new ConvexError() in the
  client-facing publish mutation (auth, ownership, deletion, version,
  dependency errors)
- Leave publishInternal and other internal mutations unchanged

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
juhgiyo added a commit that referenced this pull request Apr 12, 2026
…tations

Apply the same Error → ConvexError fix from PR #187 (roles.ts) and
PR #188 (skills.ts) to the remaining three entity files. In each
client-facing publish mutation, all throw new Error() statements are
replaced with throw new ConvexError() so error messages pass through
to the web UI instead of being stripped by Convex's security layer.

Version error messages now include the entity slug for easier debugging.
publishInternal mutations are intentionally left unchanged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
juhgiyo added a commit that referenced this pull request Apr 13, 2026
…rors (#188)

## Summary
- Apply the same Error → ConvexError fix from PR #187 (roles.ts) to
convex/skills.ts
- Add throwIfDepErrors helper with actionable messages (skill slug,
missing dep names, fix suggestion)
- Convert 7 throw statements in the client-facing publish mutation from
Error to ConvexError
- publishInternal left unchanged (httpAction catches e.message)

Fixes the same Convex security behavior where plain Error messages are
stripped from client-facing mutations — web UI users saw generic "Server
Error" instead of the actual error text.

## Test plan
- [x] All 266 existing tests pass
- [x] TypeScript compiles cleanly
- [x] Code review: NO_FURTHER_IMPROVEMENTS
- [x] Code simplifier: NO_FURTHER_IMPROVEMENTS
- [x] QA verification: all 9 acceptance criteria pass

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
juhgiyo added a commit that referenced this pull request Apr 13, 2026
#189)

## Summary
- Apply the same Error → ConvexError fix from PR #187 (roles.ts) and PR
#188 (skills.ts) to the remaining 3 files
- Convert 7 throw statements per file (21 total) in client-facing
publish mutations from Error to ConvexError
- Enhanced version error messages to include entity slug for better
debugging context
- publishInternal mutations left unchanged (httpAction catches
e.message)
- No throwIfDepErrors helper needed (these entities have no dependency
validation)

Completes the Error → ConvexError migration across all 5 publish
mutations: roles.ts (#187), skills.ts (#188), agents.ts +
integrations.ts + memories.ts (this PR).

## Test plan
- [x] All 266 existing tests pass
- [x] TypeScript compiles cleanly
- [x] Code review: NO_FURTHER_IMPROVEMENTS
- [x] Code simplifier: NO_FURTHER_IMPROVEMENTS
- [x] QA verification: all 9 acceptance criteria pass (verified
per-file)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant