{"record":{"id":"9bdb072b56eff2a4","repo":"sgl-project/sglang","slug":"cosmos3-inverse-dynamics-input-requires-an-observa","errorCode":null,"errorMessage":"Cosmos3 inverse_dynamics input requires an observation video","messagePattern":"Cosmos3 inverse_dynamics input requires an observation video","errorType":"validation","errorClass":"ValueError","httpStatus":400,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/entrypoints/action/cosmos3.py","lineNumber":176,"sourceCode":"                f\"num_frames={num_frames}, action_horizon={action_horizon}\"\n            )\n        num_frames = expected_num_frames\n    else:\n        num_frames = int(num_frames)\n        if num_frames <= 1:\n            raise ValueError(\"Cosmos3 action num_frames must be greater than 1\")\n    if (num_frames - 1) % 4 != 0:\n        raise ValueError(\n            \"Cosmos3 action_horizon must be divisible by 4 so num_frames \"\n            \"is compatible with the temporal VAE\"\n        )\n\n    images = _images_from_observation(observation)\n    video_path = options.get(\"video_path\") or observation.get(\"video\")\n    if action_mode == \"policy\" and not images:\n        raise ValueError(\"Cosmos3 policy input requires an observation image\")\n    if action_mode == \"inverse_dynamics\" and video_path is None:\n        raise ValueError(\"Cosmos3 inverse_dynamics input requires an observation video\")\n    if images and video_path is not None:\n        raise ValueError(\"Cosmos3 action requests accept either an image or a video\")\n    batch_size = len(images) if images else 1\n    max_batch_size = max(1, int(getattr(server_args, \"batching_max_size\", 1)))\n    if batch_size > max_batch_size:\n        raise ValueError(\n            f\"Cosmos3 action batch size {batch_size} exceeds \"\n            f\"--batching-max-size={max_batch_size}\"\n        )\n    image_path = None if not images else images[0] if batch_size == 1 else images\n\n    domain_id = options.get(\"domain_id\")\n    domain_name = options.get(\"domain_name\")\n    raw_action_dim = options.get(\"raw_action_dim\")\n    if domain_id is None and not domain_name:\n        raise ValueError(\"Cosmos3 action requests require domain_name or domain_id\")\n    if domain_id is not None and not domain_name and raw_action_dim is None:\n        raise ValueError(\"raw_action_dim is required when only domain_id is provided\")","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/entrypoints/action/cosmos3.py#L158-L194","documentation":"Cosmos3's inverse_dynamics mode recovers the action between an initial frame and subsequent video frames, so it requires an observation video. The endpoint checks options.video_path or observation.video and raises if both are absent for action_mode='inverse_dynamics'.","triggerScenarios":"POST /v1/actions with action_mode='inverse_dynamics' but no video/video_path in the request payload or observation.","commonSituations":"Sending an image where a video is required; video field name mismatch; upstream video upload failed silently leaving the field empty.","solutions":["Provide observation.video (path or URL) or parameters.video_path","If your observation is a single image, use action_mode='policy' instead"],"exampleFix":"# before\n{\"action_mode\": \"inverse_dynamics\", \"observation\": {\"image\": \"f0.png\"}}\n# after\n{\"action_mode\": \"inverse_dynamics\", \"observation\": {\"video\": \"rollout.mp4\"}}","handlingStrategy":"validation","validationCode":"assert params.get('video_path') or observation.get('video'), 'inverse_dynamics mode needs a video'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify the video file/URL exists and is non-empty before sending","Keep mode-specific required-field checklists in client code"],"tags":["cosmos3","inverse-dynamics","missing-video","input-validation"],"backgroundTag":"missing-required-input","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}