Repository navigation
fix(videos): return 404 when video content is not ready - #32602
Sameerlite wants to merge 2 commits into
Conversation
OpenAI returns 404 for GET /v1/videos/{id}/content while processing;
video_content_handler was ignoring non-2xx responses and the proxy
returned 200 with the error JSON as video/mp4.
Co-authored-by: Cursor <cursoragent@cursor.com>
Greptile SummaryThis PR fixes a bug where the sync and async
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| litellm/llms/custom_httpx/llm_http_handler.py | Adds response.raise_for_status() to both sync video_content_handler and async async_video_content_handler before response transformation, matching the pattern used by other handlers in this file. The httpx.HTTPStatusError is caught by the existing except Exception block and routed through _handle_error, which already handles httpx.HTTPStatusError specifically at line 5549. |
| tests/test_litellm/test_video_generation.py | Adds two new mock-only tests for sync and async 404-propagation paths. Tests use httpx.Response with a real 404 status and JSON body, which correctly triggers raise_for_status() and exercises the full error path through _handle_error. No real network calls are made. |
Reviews (3): Last reviewed commit: "test(videos): cover async video content ..." | Re-trigger Greptile
Mirror the sync not-ready test for async_video_content_handler. Co-authored-by: Cursor <cursoragent@cursor.com>
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 4440de8. Configure here.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
#43787 made video content downloads raise the upstream error, so a video that is not ready now returns a 404. Reopen if something is missing |
Summary
raise_for_status()to sync/asyncvideo_content_handlerso upstream 404s are propagated instead of returned as 200 with error JSON asvideo/mp4GET /v1/videos/{id}/contentreturns 404 with"Video is not ready yet..."while status isqueued/in_progressBefore the video generation is completed

After the video generation is completed

Note
Low Risk
Small, targeted fix that only affects error handling on the video content download path; success behavior is unchanged.
Overview
Fixes a bug where sync and async
video_content_handlertreated upstream error responses (e.g. OpenAI 404 while a video is stillqueued/in_progress) as success and passed the error JSON through the content transform—so clients could see HTTP 200 withvideo/mp4body containing JSON instead of the real status.Both paths now call
response.raise_for_status()after the GET/POST, matching other handlers inllm_http_handler.py, so failures flow through_handle_errorand surface asBaseLLMExceptionwith the upstream status and message.Tests cover sync and async handlers with a mocked 404 “Video is not ready yet” response.
Reviewed by Cursor Bugbot for commit 4440de8. Bugbot is set up for automated code reviews on this repo. Configure here.