sgl-project/sglang · warning · HTTPException
Video not found
Error message
Video not found
What it means
HTTP 404 from GET /v1/videos/{video_id} when the in-memory VIDEO_STORE contains no job with that id. The store only holds jobs created by this server process (or its configured backend), so unknown, expired, or restarted-away ids all miss.
Source
Thrown at python/sglang/multimodal_gen/runtime/entrypoints/openai/video_api.py:915
return VideoResponse(**job)
@router.get("", response_model=VideoListResponse)
async def list_videos(
after: Optional[str] = Query(None),
limit: Optional[int] = Query(None, ge=1, le=100),
order: Optional[str] = Query("desc"),
):
jobs = await VIDEO_STORE.list_page(after=after, limit=limit, order=order)
items = [VideoResponse(**job) for job in jobs]
return VideoListResponse(data=items)
@router.get("/{video_id}", response_model=VideoResponse)
async def retrieve_video(video_id: str = Path(...)):
job = await VIDEO_STORE.get(video_id)
if not job:
raise HTTPException(status_code=404, detail="Video not found")
return VideoResponse(**job)
# TODO: support aborting a job.
@router.delete("/{video_id}", response_model=VideoResponse)
async def delete_video(video_id: str = Path(...)):
job = await VIDEO_STORE.pop(video_id)
if not job:
raise HTTPException(status_code=404, detail="Video not found")
# Mark as deleted in response semantics
job["status"] = "deleted"
return VideoResponse(**job)
def _select_video_variant_path(job: dict, variant: str | None) -> str | None:
file_paths = job.get("file_paths")
if file_paths:
try:View on GitHub (pinned to 0132848349)
Solutions
- Verify the id matches exactly what the POST /v1/videos response returned
- If the server restarted, resubmit the generation — in-memory state is not persisted
- Check VIDEO_STORE retention/capacity settings and poll sooner or persist ids externally
- Ensure sticky routing / same host when multiple server replicas serve the API
Defensive patterns
Strategy: try-catch
Validate before calling
null
Try / catch
const job = await get(id).catch(e => { if (e.status === 404) return null; throw e; });
if (!job) { /* resubmit or surface 'expired' */ } Prevention
- Persist the id from the create response immediately
- Poll promptly after creation; don't assume jobs persist across restarts
- Use consistent host/sticky routing when multiple replicas exist
When it happens
Trigger: GET /v1/videos/{id} with a typo'd or truncated id, an id from a previous server process (store lost on restart), or a job evicted after the store's retention policy/capacity limit.
Common situations: Server restarted between creating the job and polling status; copy-pasting an id with whitespace or missing characters; polling long after completion when the entry was evicted; hitting a different server instance behind a load balancer than the one that created the job.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Video generation failed: {error_msg}
- Lost connection to server after {consecutive_errors} consecu
- Network error after {consecutive_errors} consecutive failure
- Video generation timed out after {max_wait_time} seconds
- Failed to generate video: {str(e)}
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/7f8b58dbc133ab6d.
Report an issue: GitHub.