{"record":{"id":"6f363b31a1e38e1a","repo":"sgl-project/sglang","slug":"grouped-pipeline-returned-fewer-outputs-than-reque","errorCode":null,"errorMessage":"Grouped pipeline returned fewer outputs than requests.","messagePattern":"Grouped pipeline returned fewer outputs than requests\\.","errorType":"error_code","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"python/sglang/multimodal_gen/runtime/managers/gpu_worker.py","lineNumber":596,"sourceCode":"                if not req.is_warmup:\n                    PerformanceLogger.log_request_summary(metrics=output_batch.metrics)\n\n            # dump per-request perf report to the server-mode file path.\n            if (\n                req.perf_dump_path is not None\n                and not req.is_warmup\n                and output_batch.metrics is not None\n            ):\n                PerformanceLogger.dump_benchmark_report(\n                    file_path=req.perf_dump_path,\n                    metrics=output_batch.metrics,\n                    meta={\"model\": self.server_args.model_path},\n                    tag=\"server_perf_dump\",\n                )\n        except Exception as e:\n            if propagate_forward_errors and forward_failed:\n                if isinstance(e, StopIteration):\n                    raise RuntimeError(\n                        \"Grouped pipeline returned fewer outputs than requests.\"\n                    ) from e\n                raise\n            logger.error(\n                f\"Error executing {error_context}: {e}\",\n                exc_info=True,\n            )\n            if isinstance(e, _oom_exceptions()):\n                logger.warning(OOM_MSG)\n            if output_batch is None:\n                output_batch = OutputBatch()\n            output_batch.error = f\"Error executing {error_context}: {e}\"\n            self._record_output_peak_memory(output_batch)\n            # clean cache if OOM\n            if not current_platform.is_cpu():\n                torch.get_device_module().empty_cache()\n        return output_batch\n","sourceCodeStart":578,"sourceCodeEnd":614,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/managers/gpu_worker.py#L578-L614","documentation":"While draining the grouped multimodal pipeline during forward execution, an exception path detected a StopIteration — the generator/pipeline yielded fewer outputs than the number of submitted requests. The engine wraps it in a RuntimeError (and only re-raises the original when propagate_forward_errors and forward_failed are set).","triggerScenarios":"execute_forward / _execute_forward_batch on a grouped batch where the pipeline generator terminates early (e.g. an internal filter or nesting bug drops outputs) so output count < len(reqs), combined with propagate_forward_errors and forward_failed being true.","commonSituations":"Upgrading the runtime with a changed grouped-pipeline contract; a custom pipeline stage that returns without yielding for some requests; OOM-adjacent partial failures inside the pipeline.","solutions":["Check server logs just above this error for the underlying exception that truncated the pipeline (it is logged with exc_info)","Report/upsert to a matching sglang issue including the model, batch composition, and the inner exception","As a workaround, run with sequential forward (execute_forward_sequentially path) or smaller batches to see if the drop is batch-shape dependent","Verify you are not mixing pipeline stage versions after a partial upgrade"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    out = worker.execute_forward(reqs)\nexcept RuntimeError as e:\n    if \"fewer outputs than requests\" in str(e):\n        logger.error(\"grouped pipeline truncated; retrying sequentially\")\n        out = worker.execute_forward_sequentially(reqs)\n    else:\n        raise","preventionTips":["Keep sglang pipeline stages and worker versions in sync","Capture the logged inner exception — the StopIteration is only the wrapper","Test grouped batches in staging before prod rollouts"],"tags":["runtime","pipeline","inference","internal-error","multimodal"],"backgroundTag":"pipeline-output-count-mismatch","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}