{"record":{"id":"3460fdd09ff6ea30","repo":"sgl-project/sglang","slug":"consumer-count-must-be-positive","errorCode":null,"errorMessage":"consumer_count must be positive","messagePattern":"consumer_count must be positive","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/multimodal/transport/memory_pool.py","lineNumber":174,"sourceCode":"class StreamOrderedMmFeaturePool:\n    \"\"\"Bounded GPU pool with generation-safe producer/consumer leases.\"\"\"\n\n    def __init__(\n        self,\n        *,\n        memory_size: int,\n        byte_tensor: torch.Tensor,\n        base_address: int,\n        device_id: int,\n        consumer_count: int,\n        recycle_interval: float,\n        transport_name: str,\n        max_inflight_slices: int = DEFAULT_MAX_INFLIGHT_SLICES,\n    ) -> None:\n        if memory_size <= 0:\n            raise ValueError(\"memory_size must be positive\")\n        if consumer_count <= 0:\n            raise ValueError(\"consumer_count must be positive\")\n        if max_inflight_slices <= 0:\n            raise ValueError(\"max_inflight_slices must be positive\")\n        if recycle_interval <= 0:\n            raise ValueError(\"recycle_interval must be positive\")\n        if (\n            not byte_tensor.is_cuda\n            or byte_tensor.device.index != device_id\n            or byte_tensor.dtype != torch.uint8\n            or not byte_tensor.is_contiguous()\n            or byte_tensor.numel() < memory_size\n        ):\n            raise ValueError(\n                \"byte_tensor must be a sufficiently large contiguous uint8 tensor \"\n                f\"on cuda:{device_id}\"\n            )\n\n        self.memory_size = memory_size\n        self.byte_tensor = byte_tensor","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multimodal/transport/memory_pool.py#L156-L192","documentation":"The transport memory pool requires consumer_count > 0 because it allocates ready/ack slots per consumer. A non-positive count would leave the pool with no valid acknowledgement topology, so the constructor raises ValueError.","triggerScenarios":"Constructing the pool with consumer_count=0 — typically a derived value from tokenizer worker count or DP size that computed to zero.","commonSituations":"Server args yielding zero tokenizer consumers; startup before topology resolution; test harnesses passing placeholder 0.","solutions":["Ensure at least one consumer (tokenizer worker) is configured","Fix --tokenizer-worker-num / DP configuration","Construct the transport only after worker topology is known"],"exampleFix":"# before\nMemoryPoolTransport(..., consumer_count=0, ...)\n# after\nMemoryPoolTransport(..., consumer_count=tokenizer_worker_num, ...)  # >=1","handlingStrategy":"validation","validationCode":"assert isinstance(consumer_count, int) and consumer_count >= 1","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Derive consumer_count from the resolved worker topology, not raw args"],"tags":["memory-pool","config-validation","cuda-ipc","multimodal-transport"],"backgroundTag":"invalid-resource-size","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}