Skip to content

backend-sync: sync-local-files returns 500 instead of 207 when Deepgram returns empty transcription #6100

@beastoin

Description

@beastoin

Problem

/v1/sync-local-files returns HTTP 500 when Deepgram returns no words for audio segments (silence/noise-only audio). The entire request fails even though the infrastructure is healthy — the audio was simply silent.

Error pattern:

sync_local_files partial failure success=0/N errors=["Deepgram returned no words for segment..."]

Impact

  • Significant error rate for heavy sync users (paying subscribers using Limitless devices with private_cloud_sync_enabled)
  • Triggers 5xx alerts unnecessarily — these are not infrastructure failures
  • Clients retry failed requests, amplifying backend load
  • Users experience sync failures for recordings that contain silence or low-quality audio segments

Expected Behavior

  • Empty Deepgram transcription (no words) should be treated as a successful-but-empty segment, not an error
  • Return 207 Multi-Status with per-segment results:
    • Segments with transcription → success with content
    • Segments with no words → success with empty transcript (not an error)
    • Segments with actual failures (DG timeout, auth error, infra issue) → error
  • Only return 500 for real infrastructure failures

Current Behavior

Any segment where Deepgram returns no words causes the entire request to fail with 500, even when DG processed the audio successfully — it just had nothing to transcribe.

Location

backend/routers/sync.py — the sync_local_files endpoint

Fix Direction

  1. In the segment processing loop, distinguish between "DG returned successfully but with no words" vs "DG failed"
  2. Treat no-words as a successful empty result, not an exception
  3. Aggregate per-segment results and return 207 when there's a mix of outcomes
  4. Reserve 500 for actual infrastructure errors (timeouts, auth failures, connection errors)

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendBackend Task (python)bugSomething isn't workingp1Priority: Critical (score 22-29)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions