{"record":{"id":"7a15b1eb0305e969","repo":"sgl-project/sglang","slug":"total-consumer-count-must-be-positive","errorCode":null,"errorMessage":"total_consumer_count must be positive","messagePattern":"total_consumer_count must be positive","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/multimodal/transport/memory_pool.py","lineNumber":93,"sourceCode":"            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:\n        if total_consumer_count <= 0:\n            raise ValueError(\"total_consumer_count must be positive\")\n        self.ready_byte_offset = ready_byte_offset\n        self.ack_byte_offset = ack_byte_offset\n        self.generation = generation\n        self.total_consumer_count = total_consumer_count\n        self.transport_name = transport_name\n        self._consumer_acknowledged = False\n\n    def _wait_until_ready(self, base_address: int, device_id: int) -> None:\n        stream_wait_value32(\n            device_id,\n            base_address + self.ready_byte_offset,\n            self.generation,\n            self.transport_name,\n        )\n\n    def _acknowledge_on_stream(\n        self,\n        base_address: int,","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/multimodal/transport/memory_pool.py#L75-L111","documentation":"StreamOrderedConsumer initialization requires total_consumer_count > 0 because ready/ack bookkeeping allocates one slot per consumer. Zero or negative counts would make acknowledgement arithmetic and slot offsets invalid, so it fails fast with ValueError.","triggerScenarios":"Constructing the IPC transport (whose __init__ calls _init_stream_ordered_consumer) with total_consumer_count=0 — typically because the tokenizer worker count resolved to 0 at startup.","commonSituations":"Degenerate configs (dp=1 with 0 tokenizer workers computed), early-startup races where worker counts are not yet populated, or tests passing 0 explicitly.","solutions":["Ensure the tokenizer worker / consumer count is at least 1 before starting the server","Fix server args (--tokenizer-worker-num, --dp-size) so computed consumer count > 0","Delay transport construction until worker topology is resolved"],"exampleFix":"# before\n_init_stream_ordered_consumer(..., total_consumer_count=0, ...)\n# after\n_init_stream_ordered_consumer(..., total_consumer_count=num_tokenizer_workers, ...)  # >=1","handlingStrategy":"validation","validationCode":"if total_consumer_count is None or total_consumer_count < 1:\n    raise ValueError('consumer count must be >= 1')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Resolve worker topology before constructing transports","Add config sanity checks at server startup"],"tags":["cuda-ipc","config-validation","multimodal-transport"],"backgroundTag":"invalid-resource-size","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}