/movie and /tv endpoints stream via SSE — error handling looks different from a standard JSON API. This page covers every failure mode and the recommended pattern for each.
These error handling examples connect to your self-hosted Vyla API instance. Replace
http://localhost:7860 with your actual API URL when deploying to production.Error Response Shape
Non-streaming endpoints (/health, /subtitles, /downloads, /test) return standard JSON errors:
For
/movie and /tv, HTTP 200 is returned immediately when the SSE stream opens. Failures surface as zero source events followed by a done event with total: 0 — not as HTTP error codes.
Handling No Sources
The most common failure — all providers failed to return a playable stream. Detect it by checkingtotal in the done event.
Source Fallback Queue
Sources stream in as providers resolve. Queue everysource event URL and fall back to the next one if playback fails mid-stream:
Network Timeouts
The SSE stream can stay open 20+ seconds while slow providers resolve. Set a client-side timeout usingAbortController:
Handling Missing Subtitles
Subtitles arrive in themeta event. Always guard against an empty array:

