{"record":{"id":"af76aa0ff10d0648","repo":"sgl-project/sglang","slug":"sampling-observer-does-not-support-pipeline-parall","errorCode":null,"errorMessage":"sampling observer does not support pipeline-parallel transport","messagePattern":"sampling observer does not support pipeline-parallel transport","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/sampling/sampling_observer_pp.py","lineNumber":75,"sourceCode":"            raise RuntimeError(f\"duplicate auxiliary PP tensor {name!r}\")\n        tensors[key] = tensor\n\n\ndef pop_auxiliary_output_from_pp_tensors(\n    tensors: MutableMapping[str, Any],\n    observer: Optional[SamplingObserver],\n) -> Optional[DeviceAuxiliaryOutput]:\n    output_tensors = {\n        key.removeprefix(_OUTPUT_PREFIX): value\n        for key, value in tensors.items()\n        if key.startswith(_OUTPUT_PREFIX)\n    }\n    if not output_tensors:\n        return None\n    if observer is None:\n        raise RuntimeError(\"received auxiliary PP output without a sampling observer\")\n    if not isinstance(observer, PipelineParallelSamplingObserver):\n        raise RuntimeError(\n            \"sampling observer does not support pipeline-parallel transport\"\n        )\n    if any(not torch.is_tensor(tensor) for tensor in output_tensors.values()):\n        raise RuntimeError(\"received a non-tensor auxiliary PP output\")\n\n    output = observer.from_pp_tensors(output_tensors)\n    if output is None:\n        raise RuntimeError(\"sampling observer did not reconstruct its PP output\")\n    for name in output_tensors:\n        del tensors[f\"{_OUTPUT_PREFIX}{name}\"]\n    return output\n","sourceCodeStart":57,"sourceCodeEnd":87,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/sampling/sampling_observer_pp.py#L57-L87","documentation":"Auxiliary PP tensors were received and an observer exists, but it is not a PipelineParallelSamplingObserver, so it lacks from_pp_tensors to reconstruct the output.","triggerScenarios":"Passing a plain SamplingObserver (or subclass without PP support) to pop_auxiliary_output_from_pp_tensors.","commonSituations":"Reusing a non-PP observer implementation under pipeline parallelism; new observer type not implementing the PP protocol.","solutions":["Use/wrap a PipelineParallelSamplingObserver on PP receiving stages","Implement from_pp_tensors on the observer subclass","Disable auxiliary PP outputs if the observer can't consume them"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"from sglang.srt.sampling.sampling_observer_pp import PipelineParallelSamplingObserver\nif aux_present and not isinstance(observer, PipelineParallelSamplingObserver):\n    raise/convert before popping","typeGuard":"def is_pp_observer(o) -> bool:\n    from sglang.srt.sampling.sampling_observer_pp import PipelineParallelSamplingObserver\n    return isinstance(o, PipelineParallelSamplingObserver)","tryCatchPattern":null,"preventionTips":["Construct PP-specific observers when pipeline parallelism is enabled","Implement from_pp_tensors on custom observers"],"tags":["pipeline-parallel","sampling","observer","type-validation"],"backgroundTag":"protocol-mismatch-distributed-transport","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}