Skip to content

Bug: file_metadata mutations throw raw Error instead of ConvexError — opaque Server Errors on client #2001

Description

@yannickmonney

Area

services/platform/convex/file_metadata/ — public mutations (saveFileMetadata, skipTranscription, retryTranscription) and the public action (transcribeDictation).

Steps to reproduce

  1. Upload a file that is rejected by organization policy — the mutation throws a raw Error.
  2. Attempt to skip transcription on an already-completed or non-running row — raw Error.
  3. Attempt to retry transcription on a row that is not in failed/skipped state — raw Error.
  4. Record a dictation snippet larger than 8 MiB — raw Error from transcribeDictation.

Expected

The client receives a ConvexError with a structured code field so the UI can display a user-readable message (following the pattern in tasks/mutations.ts).

Actual

throw new Error(...) is used throughout; Convex surfaces these as opaque "Server Error" messages in the browser console and the message is lost to the client.

Evidence

services/platform/convex/file_metadata/mutations.ts:38throw new Error('Unauthenticated') (saveFileMetadata)
services/platform/convex/file_metadata/mutations.ts:52throw new Error(check.reason ?? 'Upload rejected by organization policy')
services/platform/convex/file_metadata/mutations.ts:70throw new Error('Thread does not belong to this organization')
services/platform/convex/file_metadata/mutations.ts:269throw new Error('Unauthenticated') (skipTranscription)
services/platform/convex/file_metadata/mutations.ts:276throw new Error('File not found') (skipTranscription)
services/platform/convex/file_metadata/mutations.ts:278throw new Error('Not authorized') (skipTranscription)
services/platform/convex/file_metadata/mutations.ts:290throw new Error(\Cannot skip transcription in status "..." ...`) services/platform/convex/file_metadata/mutations.ts:323throw new Error('Unauthenticated')(retryTranscription)services/platform/convex/file_metadata/mutations.ts:330throw new Error('File not found')(retryTranscription)services/platform/convex/file_metadata/mutations.ts:332throw new Error('Not authorized')(retryTranscription)services/platform/convex/file_metadata/mutations.ts:344throw new Error(`Cannot retry transcription in status "..." ...`) services/platform/convex/file_metadata/transcribe_dictation.ts:40throw new Error('Unauthenticated')(transcribeDictation action)services/platform/convex/file_metadata/transcribe_dictation.ts:56throw new Error('Dictation audio exceeds 8 MiB limit')`

Notes

Related: #1993 (same pattern in websites/customers/vendors), #2000 (same pattern in knowledge_entries). The internal-action errors in transcribe_audio.ts:390,412 are scheduler-invoked pipeline errors (not direct client calls) and are appropriately left as raw Error.

Severity: medium — upload policy rejections and transcription skip/retry state violations surface as opaque "Server Error" with no user-readable feedback.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions