{"record":{"id":"8f48c0f0713fc939","repo":"sgl-project/sglang","slug":"option-must-use-component-value-entries","errorCode":null,"errorMessage":"{option} must use component=value entries","messagePattern":"(.+?) must use component=value entries","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/server_args/server_args.py","lineNumber":1053,"sourceCode":"        if isinstance(value, dict):\n            return {str(k): str(v) for k, v in value.items()}\n        if not isinstance(value, str):\n            raise ValueError(\n                f\"{option} must be a dict or a comma-separated component=value string\"\n            )\n        try:\n            parsed = json.loads(value)\n            if isinstance(parsed, dict):\n                return {str(k): str(v) for k, v in parsed.items()}\n        except json.JSONDecodeError:\n            pass\n        result: dict[str, str] = {}\n        for pair in value.split(\",\"):\n            pair = pair.strip()\n            if not pair:\n                continue\n            if \"=\" not in pair:\n                raise ValueError(f\"{option} must use component=value entries\")\n            component, entry = pair.split(\"=\", 1)\n            result[component.strip()] = entry.strip()\n        return result\n\n    def layerwise_tuning_for(\n        self, component_name: str | None, *, dit_group: bool\n    ) -> tuple[float, float, str]:\n        \"\"\"Prefetch size, resident layers and residency policy for one component.\"\"\"\n        prefetch_map = self._parse_component_value_map(\n            self.layerwise_prefetch_size, option=\"--layerwise-prefetch-size\"\n        )\n        resident_map = self._parse_component_value_map(\n            self.layerwise_resident_layers, option=\"--layerwise-resident-layers\"\n        )\n        policy_map = self._parse_component_value_map(\n            self.layerwise_residency_policy, option=\"--layerwise-residency-policy\"\n        )\n","sourceCodeStart":1035,"sourceCodeEnd":1071,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/server_args/server_args.py#L1035-L1071","documentation":"Raised while parsing a comma-separated component=value map (e.g. --dit-layerwise-residency-policy or similar per-component options). Each comma-separated entry must contain an '=' separating the component name from its value; an entry without '=' cannot be interpreted. The parser is shared by the layerwise-tuning option family.","triggerScenarios":"Passing a CLI value like \"dit=layerwise_offload,vae\" (second pair lacks '='), or a bare token like \"resident\" instead of \"dit=resident\".","commonSituations":"Typing a single global value instead of per-component pairs; forgetting the '=' for one entry in a multi-entry list; stray commas producing empty/garbage tokens after stripping.","solutions":["Rewrite the value as component=value pairs, e.g. 'dit=layerwise_offload,vae=resident'","Check for stray commas or missing '=' in each comma-separated entry","If a JSON form is supported for this option, use JSON instead of pair syntax"],"exampleFix":"# before\n--dit-layerwise-residency-policy layerwise_offload\n# after\n--dit-layerwise-residency-policy dit=layerwise_offload","handlingStrategy":"validation","validationCode":"def parse_component_pairs(value: str, option: str) -> dict[str, str]:\n    out = {}\n    for pair in value.split(','):\n        pair = pair.strip()\n        if not pair:\n            continue\n        assert '=' in pair, f'{option}: entry {pair!r} missing \"=\"'\n        k, v = pair.split('=', 1)\n        out[k.strip()] = v.strip()\n    return out","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate pair syntax before passing CLI strings","Prefer JSON form for complex maps","Unit-test config strings in CI"],"tags":["config","cli","validation","layerwise-offload"],"backgroundTag":"invalid-cli-argument-format","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}