{"record":{"id":"5bc0b7a3dca5e385","repo":"sgl-project/sglang","slug":"at-least-one-of-text-input-ids-or-image-should-b","errorCode":null,"errorMessage":"At least one of text, input_ids, or image should be provided","messagePattern":"At least one of text, input_ids, or image should be provided","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/managers/io_struct.py","lineNumber":1180,"sourceCode":"        if isinstance(self.rid, list):\n            self.rid = [uuid.uuid4().hex for _ in range(len(self.rid))]\n        else:\n            self.rid = uuid.uuid4().hex\n        return self.rid\n\n    def _validate_rid_uniqueness(self):\n        \"\"\"Validate that request IDs within a batch are unique.\"\"\"\n        if isinstance(self.rid, list) and len(set(self.rid)) != len(self.rid):\n            counts = Counter(self.rid)\n            duplicates = [rid for rid, count in counts.items() if count > 1]\n            raise ValueError(\n                f\"Duplicate request IDs detected within the request: {duplicates}\"\n            )\n\n    def normalize_batch_and_arguments(self):\n        # at least one of text, input_ids, or image should be provided\n        if self.text is None and self.input_ids is None and self.image_data is None:\n            raise ValueError(\n                \"At least one of text, input_ids, or image should be provided\"\n            )\n\n        # text and input_ids cannot be provided at the same time\n        if self.text is not None and self.input_ids is not None:\n            raise ValueError(\"text and input_ids cannot be provided at the same time\")\n\n        # Derive the batch size\n        self.batch_size = 0\n        self.is_single = True\n\n        # check the batch size of text\n        if self.text is not None:\n            if isinstance(self.text, list):\n                self.batch_size += len(self.text)\n                self.is_single = False\n            else:\n                self.batch_size += 1","sourceCodeStart":1162,"sourceCodeEnd":1198,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/managers/io_struct.py#L1162-L1198","documentation":"normalize_batch_and_arguments requires at least one input modality: text, input_ids, or image_data. All three being None means there is nothing to tokenize/embed, so the request is rejected up front.","triggerScenarios":"GenerateReqInput(sampling_params={...}) with no text/input_ids/image_data; a client sends JSON {} or only sampling fields; passing empty string via a variable that is actually None.","commonSituations":"Client bug where the prompt variable is None due to upstream extraction failure; building requests programmatically from possibly-empty records.","solutions":["Supply text='...', input_ids=[...], or image_data=[...]","Debug why the prompt field is None before constructing the request","For embed-only or multimodal calls, still include the text or image"],"exampleFix":"// before\nreq = GenerateReqInput(sampling_params={'temperature':0.7})\n// after\nreq = GenerateReqInput(text='Hello', sampling_params={'temperature':0.7})","handlingStrategy":"validation","validationCode":"assert text is not None or input_ids is not None or image_data is not None","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Log and skip records with empty prompts before constructing requests"],"tags":["sglang","empty-input","request-validation"],"backgroundTag":"empty-request-payload","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}