Area
services/platform/convex/folders/mutations.ts — createFolder, renameFolder, moveFolder, reassignFolderTeam mutations.
Steps to reproduce
- Try to create a folder with an empty name, too-long name, duplicate name, or into a team you do not belong to.
- Any error is surfaced to the client as an opaque "Server Error" rather than a structured
ConvexError.
Expected
User-facing validation and permission errors (empty name, duplicate, max depth, team mismatch, unauthenticated, access denied) are thrown as ConvexError({ code: ... }) so the frontend can render them as structured toast/inline errors.
Actual
Every error path in all four folder mutations throws new Error(string):
- Auth check, parent-not-found, parent-not-accessible, max-depth, team-not-member, duplicate-name, folder-not-found, access-denied, invalid-name variants all use raw
Error.
Evidence
services/platform/convex/folders/mutations.ts:130-141 — validateFolderName() (called in all mutations)
services/platform/convex/folders/mutations.ts:162 — duplicate name check
services/platform/convex/folders/mutations.ts:177-220 — createFolder handler (Unauthenticated, Parent folder not found, Parent folder not accessible, Maximum folder nesting depth exceeded, Cannot create folder in a team you do not belong to)
services/platform/convex/folders/mutations.ts:250-270 — renameFolder (Unauthenticated, Folder not found, Access denied)
services/platform/convex/folders/mutations.ts:296-315 — deleteFolder (Unauthenticated, Folder not found, Access denied)
services/platform/convex/folders/mutations.ts:353-386 — reassignFolderTeam (Unauthenticated, Folder not found, Cannot change team, Access denied, Cannot assign folder to a team you do not belong to)
Notes
tasks/mutations.ts and tasks/review_mutations.ts already use ConvexError({ code: ... }) as the correct pattern. Folder mutations should follow the same convention.
Area
services/platform/convex/folders/mutations.ts—createFolder,renameFolder,moveFolder,reassignFolderTeammutations.Steps to reproduce
ConvexError.Expected
User-facing validation and permission errors (empty name, duplicate, max depth, team mismatch, unauthenticated, access denied) are thrown as
ConvexError({ code: ... })so the frontend can render them as structured toast/inline errors.Actual
Every error path in all four folder mutations throws
new Error(string):Error.Evidence
services/platform/convex/folders/mutations.ts:130-141—validateFolderName()(called in all mutations)services/platform/convex/folders/mutations.ts:162— duplicate name checkservices/platform/convex/folders/mutations.ts:177-220—createFolderhandler (Unauthenticated, Parent folder not found, Parent folder not accessible, Maximum folder nesting depth exceeded, Cannot create folder in a team you do not belong to)services/platform/convex/folders/mutations.ts:250-270—renameFolder(Unauthenticated, Folder not found, Access denied)services/platform/convex/folders/mutations.ts:296-315—deleteFolder(Unauthenticated, Folder not found, Access denied)services/platform/convex/folders/mutations.ts:353-386—reassignFolderTeam(Unauthenticated, Folder not found, Cannot change team, Access denied, Cannot assign folder to a team you do not belong to)Notes
tasks/mutations.tsandtasks/review_mutations.tsalready useConvexError({ code: ... })as the correct pattern. Folder mutations should follow the same convention.