{"record":{"id":"4b862566dea20a07","repo":"sgl-project/sglang","slug":"e","errorCode":null,"errorMessage":"{e}","messagePattern":"\\{e\\}","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/entrypoints/openai/video_api.py","lineNumber":836,"sourceCode":"    # Resolve per-request output_path override\n    effective_output_path = req.output_path or server_args.output_path\n    if effective_output_path is None:\n        output_tmp = tempfile.mkdtemp(prefix=\"sglang_output_\")\n        temp_dirs.append(output_tmp)\n        effective_output_path = output_tmp\n        output_persistent = False\n\n    # Inject resolved output_path so _build_video_sampling_params picks it up\n    req.output_path = effective_output_path\n\n    logger.debug(f\"Server received from create_video endpoint: req={req}\")\n\n    try:\n        sampling_params = _build_video_sampling_params(request_id, req)\n    except (ValueError, TypeError) as e:\n        for td in temp_dirs:\n            shutil.rmtree(td, ignore_errors=True)\n        raise HTTPException(status_code=400, detail=str(e))\n\n    batch: Req | None = None\n    scheduler_batches: list[Req] | None = None\n    try:\n        # Build Req for scheduler.\n        trace_headers = extract_trace_headers(request.headers)\n        batch = prepare_request(\n            server_args=server_args,\n            sampling_params=sampling_params,\n            external_trace_header=trace_headers,\n        )\n        # Add diffusers_kwargs if provided.\n        if req.diffusers_kwargs:\n            batch.extra[\"diffusers_kwargs\"] = req.diffusers_kwargs\n            if \"max_sequence_length\" in req.diffusers_kwargs:\n                batch.max_sequence_length = req.diffusers_kwargs[\"max_sequence_length\"]\n            if \"flow_shift\" in req.diffusers_kwargs:\n                batch.flow_shift = req.diffusers_kwargs[\"flow_shift\"]","sourceCodeStart":818,"sourceCodeEnd":854,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/entrypoints/openai/video_api.py#L818-L854","documentation":"Returned as HTTP 400 by the video generation endpoint when building sampling parameters from the request fails with a ValueError or TypeError. The _build_video_sampling_params helper validates numeric ranges (e.g. frames, fps, sampling settings) and their types; invalid combinations are converted into a 400 with the raw message. Temp dirs created for the request are cleaned before raising.","triggerScenarios":"POST /v1/videos where sampling-related fields (duration, fps, frames, seed, size, guidance scale, etc.) are out of allowed ranges, negative, non-numeric strings, or mutually incompatible so that _build_video_sampling_params raises ValueError/TypeError.","commonSituations":"Requesting a frame count or resolution the loaded video model does not support; passing strings like \"30\" where numbers are expected; copying sampling params tuned for a different model; model-specific constraints (e.g. frames % spatial patch size != 0) failing.","solutions":["Read the detail string — it contains the exact ValueError/TypeError message naming the invalid param and its constraint","Align sampling params with the deployed model's supported values (check model card / server startup logs for supported sizes and frame counts)","Coerce types client-side: send numbers, not numeric strings","Retry with conservative defaults (omit optional sampling fields entirely to use server defaults)"],"exampleFix":"// before\n{\"model\": \"m\", \"prompt\": \"p\", \"duration\": -5, \"fps\": \"thirty\"}\n// after\n{\"model\": \"m\", \"prompt\": \"p\", \"duration\": 5, \"fps\": 30}","handlingStrategy":"validation","validationCode":"assert 0 < req.duration <= 60\nassert isinstance(req.fps, int) and req.fps > 0\n# omit optional sampling fields to use server defaults when unsure","typeGuard":null,"tryCatchPattern":"try { await create(req); } catch (e) { if (e.status === 400 && /param/i.test(e.detail)) fixParamFromMessage(e.detail); }","preventionTips":["Know the model's supported resolution/fps/frame grid before setting sampling fields","Send numbers not strings for numeric fields","Start with defaults, add one param at a time"],"tags":["http-400","sampling-params","video-generation","out-of-range"],"backgroundTag":"invalid-sampling-params","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}