{"record":{"id":"5e89d0217e640c72","repo":"sgl-project/sglang","slug":"every-cache-salt-should-be-a-string","errorCode":null,"errorMessage":"Every cache_salt should be a string.","messagePattern":"Every cache_salt should be a string\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/managers/io_struct.py","lineNumber":812,"sourceCode":"            self.extra_key = [value or None for value in self.extra_key]\n            self.extra_key = self.extra_key * self.parallel_sample_num\n        else:\n            raise ValueError(\"extra_key should be a list or a string.\")\n\n    def _normalize_cache_salt(self, num):\n        \"\"\"Normalize cache_salt for batch processing.\"\"\"\n        if self.cache_salt is None:\n            return\n        if isinstance(self.cache_salt, str):\n            value = self.cache_salt or None\n            self.cache_salt = [value] * num\n        elif isinstance(self.cache_salt, list):\n            if len(self.cache_salt) != self.batch_size:\n                raise ValueError(\n                    \"The length of cache_salt should be equal to the batch size.\"\n                )\n            if any(not isinstance(value, str) for value in self.cache_salt):\n                raise ValueError(\"Every cache_salt should be a string.\")\n            self.cache_salt = [value or None for value in self.cache_salt]\n            self.cache_salt = self.cache_salt * self.parallel_sample_num\n        else:\n            raise ValueError(\"cache_salt should be a list or a string.\")\n\n    def _normalize_bootstrap_params(self, num):\n        \"\"\"Normalize bootstrap parameters for batch processing.\"\"\"\n        # Normalize bootstrap_host\n        if self.bootstrap_host is None:\n            self.bootstrap_host = [None] * num\n        elif not isinstance(self.bootstrap_host, list):\n            self.bootstrap_host = [self.bootstrap_host] * num\n        elif isinstance(self.bootstrap_host, list):\n            self.bootstrap_host = self.bootstrap_host * self.parallel_sample_num\n\n        # Normalize bootstrap_port\n        if self.bootstrap_port is None:\n            self.bootstrap_port = [None] * num","sourceCodeStart":794,"sourceCodeEnd":830,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/managers/io_struct.py#L794-L830","documentation":"Raised when cache_salt is a list containing at least one non-string element. Each per-request salt must be a str (empty string normalizes to None, meaning no salting).","triggerScenarios":"cache_salt=[None, 's'] or [1, 2] with batch_size=2.","commonSituations":"Using bytes from hashes, ints, or None placeholders in the salt list.","solutions":["Convert elements to str: [str(s) for s in salts]","Use '' for requests needing no salt","Use a single str for uniform salting"],"exampleFix":"// before\ncache_salt=[b'hash1', b'hash2']\n// after\ncache_salt=['hash1', 'hash2']","handlingStrategy":"validation","validationCode":"assert all(isinstance(s, str) for s in cache_salt), 'salts must be str'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["str() salts at construction; '' means no salt"],"tags":["sglang","cache-salt","type-error","input-validation"],"backgroundTag":"request-input-validation-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}