sgl-project/sglang · critical · RuntimeError
{transport_name} consumer rank {rank} is outside [0, {total_
Error message
{transport_name} consumer rank {rank} is outside [0, {total_consumer_count}) What it means
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.
Source
Thrown at python/sglang/srt/multimodal/transport/memory_pool.py:73
) -> int:
if total_consumer_count == 1:
return 0
if consumer_rank is None:
try:
from sglang.srt.runtime_context import get_parallel
# Use the global TP rank. An attention/DCP subgroup rank can alias
# another consumer's acknowledgement slot.
rank = int(get_parallel().tp_rank)
except Exception as exc:
raise RuntimeError(
f"Cannot resolve the {transport_name} consumer rank before "
"parallel state initialization"
) from exc
else:
rank = int(consumer_rank)
if not 0 <= rank < total_consumer_count:
raise RuntimeError(
f"{transport_name} consumer rank {rank} is outside "
f"[0, {total_consumer_count})"
)
return rank
class StreamOrderedPoolConsumerMixin:
"""Ready/wait/ack protocol for stream-ordered GPU feature proxies."""
def _init_stream_ordered_consumer(
self,
*,
ready_byte_offset: int,
ack_byte_offset: int,
generation: int,
total_consumer_count: int,
transport_name: str,
) -> None:View on GitHub (pinned to 0132848349)
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
Example fix
# before ack(consumer_rank=8) # total_consumer_count=4 # after ack(consumer_rank=rank % 4)
Defensive patterns
Strategy: validation
Validate before calling
assert 0 <= consumer_rank < total_consumer_count, 'rank out of range'
Prevention
- Use runtime-provided ranks, never hardcoded values
- Cross-check total_consumer_count against actual worker topology at init
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- total_pool_size must be positive
- tokenizer_worker_num must be positive
- Input 'data' must be a torch.Tensor, but got {type}
- Cannot resolve the {transport_name} consumer rank before par
- total_consumer_count must be positive
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/c0091cb8d2d1ae55.
Report an issue: GitHub.