{"record":{"id":"c0091cb8d2d1ae55","repo":"sgl-project/sglang","slug":"transport-name-consumer-rank-rank-is-outside","errorCode":null,"errorMessage":"{transport_name} consumer rank {rank} is outside [0, {total_consumer_count})","messagePattern":"(.+?) consumer rank (.+?) is outside \\[0, (.+?)\\)","errorType":"error_code","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"python/sglang/srt/multimodal/transport/memory_pool.py","lineNumber":73,"sourceCode":") -> int:\n    if total_consumer_count == 1:\n        return 0\n    if consumer_rank is None:\n        try:\n            from sglang.srt.runtime_context import get_parallel\n\n            # Use the global TP rank. An attention/DCP subgroup rank can alias\n            # another consumer's acknowledgement slot.\n            rank = int(get_parallel().tp_rank)\n        except Exception as exc:\n            raise RuntimeError(\n                f\"Cannot resolve the {transport_name} consumer rank before \"\n                \"parallel state initialization\"\n            ) from exc\n    else:\n        rank = int(consumer_rank)\n    if not 0 <= rank < total_consumer_count:\n        raise RuntimeError(\n            f\"{transport_name} consumer rank {rank} is outside \"\n            f\"[0, {total_consumer_count})\"\n        )\n    return rank\n\n\nclass StreamOrderedPoolConsumerMixin:\n    \"\"\"Ready/wait/ack protocol for stream-ordered GPU feature proxies.\"\"\"\n\n    def _init_stream_ordered_consumer(\n        self,\n        *,\n        ready_byte_offset: int,\n        ack_byte_offset: int,\n        generation: int,\n        total_consumer_count: int,\n        transport_name: str,\n    ) -> None:","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multimodal/transport/memory_pool.py#L55-L91","documentation":"After resolving the consumer rank (explicitly or from tp_rank), the transport validates 0 <= rank < total_consumer_count. A rank at or beyond the consumer count would write acknowledgements into another transport's slot space, so it is rejected with this RuntimeError.","triggerScenarios":"Passing consumer_rank equal to or above the number of tokenizer workers / consumers, or a TP-rank/DP-size misconfiguration making global tp_rank exceed the transport's consumer count.","commonSituations":"Mixing up global TP rank vs attention subgroup rank in mixedparallel setups; hardcoding a rank in tests larger than the consumer count; wrong total_consumer_count passed at pool construction.","solutions":["Verify consumer_rank < number of consumers; use 0-based ranks","Check total_consumer_count matches the actual tokenizer/TP worker count at pool construction","Use the rank returned by the runtime rather than a hardcoded value"],"exampleFix":"# before\nack(consumer_rank=8)  # total_consumer_count=4\n# after\nack(consumer_rank=rank % 4)","handlingStrategy":"validation","validationCode":"assert 0 <= consumer_rank < total_consumer_count, 'rank out of range'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use runtime-provided ranks, never hardcoded values","Cross-check total_consumer_count against actual worker topology at init"],"tags":["distributed","rank-validation","cuda-ipc","multimodal-transport"],"backgroundTag":"rank-out-of-range","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}