{"record":{"id":"fd52d0f58335c721","repo":"sgl-project/sglang","slug":"camera-conditions-batch-dimension-must-be-1-or-mat","errorCode":null,"errorMessage":"camera_conditions batch dimension must be 1 or match request batch size {batch_size}, got {camera_conditions.shape[0]}.","messagePattern":"camera_conditions batch dimension must be 1 or match request batch size (.+?), got (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/base.py","lineNumber":1882,"sourceCode":"                \"camera_conditions/chunk_plucker.\"\n            )\n        if camera_conditions is not None:\n            camera_conditions = (\n                camera_conditions\n                if isinstance(camera_conditions, torch.Tensor)\n                else torch.as_tensor(camera_conditions)\n            ).to(device=device, dtype=camera_compute_dtype)\n            if camera_conditions.dim() == 2:\n                camera_conditions = camera_conditions.unsqueeze(0)\n            if camera_conditions.dim() != 3:\n                raise ValueError(\n                    \"camera_conditions must have shape (T,20) or (B,T,20), \"\n                    f\"got {tuple(camera_conditions.shape)}\"\n                )\n            if camera_conditions.shape[0] == 1 and batch_size > 1:\n                camera_conditions = camera_conditions.expand(batch_size, -1, -1)\n            if camera_conditions.shape[0] != batch_size:\n                raise ValueError(\n                    \"camera_conditions batch dimension must be 1 or match \"\n                    f\"request batch size {batch_size}, got \"\n                    f\"{camera_conditions.shape[0]}.\"\n                )\n            if camera_conditions.shape[-1] != 20:\n                raise ValueError(\n                    \"camera_conditions must have last dimension 20, got \"\n                    f\"{tuple(camera_conditions.shape)}\"\n                )\n            if camera_conditions.shape[1] == T_lat:\n                source = \"prepacked\"\n                if chunk_plucker is None and requires_chunk_plucker:\n                    raise ValueError(\n                        \"Prepacked latent-frame camera_conditions require \"\n                        \"chunk_plucker for this SANA-WM checkpoint. Pass \"\n                        \"chunk_plucker with shape (B,48,T,H,W), or pass \"\n                        \"original-frame camera_conditions so SGLang can \"\n                        \"derive chunk_plucker.\"","sourceCodeStart":1864,"sourceCodeEnd":1900,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/sana_wm/base.py#L1864-L1900","documentation":"After normalization to (B,T,20), the leading batch dim must be 1 (auto-expanded to the request batch) or exactly equal to the request batch size. Any other value raises this ValueError.","triggerScenarios":"Sending a batch of N requests while camera_conditions has B cameras with 1 < B != N, e.g. 3 camera paths with batch_size=2.","commonSituations":"Mixing a per-prompt camera path list with batched server requests, or reusing a cached multi-camera conditioning tensor for a different request batch size.","solutions":["Make camera_conditions length match the number of requests in the batch.","Pass a single (1,T,20) camera path to have it broadcast to all requests.","Regenerate the camera tensor whenever the request batch composition changes."],"exampleFix":"# before\ncond = build_cameras_for(4_requests)  # (4,T,20) with batch_size=2\n# after\ncond = cond[:batch_size]  # or pass (1,T,20) to broadcast","handlingStrategy":"validation","validationCode":"if cond.shape[0] not in (1, batch_size):\n    cond = cond[:batch_size]  # or rebuild per request","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Derive camera tensors from the same request list used for the batch.","Prefer (1,T,20) single-path inputs for homogeneous batches."],"tags":["sglang","sana-wm","camera-conditions","batch-size-mismatch"],"backgroundTag":"batch-dimension-mismatch","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}