{"record":{"id":"89c7e33db71873c6","repo":"sgl-project/sglang","slug":"invalid-type-for-item-in-lora-paths-list-type","errorCode":null,"errorMessage":"Invalid type for item in --lora-paths list: {type(lora_path)}. Expected a string or a dictionary.","messagePattern":"Invalid type for item in --lora-paths list: (.+?)\\. Expected a string or a dictionary\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/server_args.py","lineNumber":10602,"sourceCode":"                                lora_id=LoRARef.deterministic_id(lora_path, lora_path),\n                                lora_name=lora_path,\n                                lora_path=lora_path,\n                                pinned=False,\n                            )\n                    elif isinstance(lora_path, dict):\n                        assert (\n                            \"lora_name\" in lora_path and \"lora_path\" in lora_path\n                        ), f\"When providing LoRA paths as a list of dict, each dict should contain 'lora_name' and 'lora_path' keys. Got: {lora_path}\"\n                        lora_ref = LoRARef(\n                            lora_id=LoRARef.deterministic_id(\n                                lora_path[\"lora_name\"], lora_path[\"lora_path\"]\n                            ),\n                            lora_name=lora_path[\"lora_name\"],\n                            lora_path=lora_path[\"lora_path\"],\n                            pinned=lora_path.get(\"pinned\", False),\n                        )\n                    else:\n                        raise ValueError(\n                            f\"Invalid type for item in --lora-paths list: {type(lora_path)}. \"\n                            \"Expected a string or a dictionary.\"\n                        )\n                    parsed_lora_paths.append(lora_ref)\n                self._late_resolution(\n                    \"check_lora_server_args\", lora_paths=parsed_lora_paths\n                )\n            elif isinstance(cfg.lora_paths, dict):\n                self._late_resolution(\n                    \"check_lora_server_args\",\n                    lora_paths=[\n                        LoRARef(\n                            lora_id=LoRARef.deterministic_id(k, v),\n                            lora_name=k,\n                            lora_path=v,\n                            pinned=False,\n                        )\n                        for k, v in cfg.lora_paths.items()","sourceCodeStart":10584,"sourceCodeEnd":10620,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/server_args.py#L10584-L10620","documentation":"Raised while parsing --lora-paths when a list item is neither a string nor a dict. Each list entry must be a plain adapter path string or a dict with lora_name/lora_path/pinned keys.","triggerScenarios":"Passing --lora-paths as a JSON list containing a number, boolean, nested list, or null element, e.g. '[\"/a\", 42]'.","commonSituations":"Hand-written JSON on the command line with a typo, or a script that builds the list from unvalidated user input.","solutions":["Make every list element a string path or an object {\"lora_name\": ..., \"lora_path\": ..., \"pinned\": bool}","Validate the JSON with jq/python before launching the server"],"exampleFix":"# before\n--lora-paths '[\"/models/lora-a\", 123]'\n# after\n--lora-paths '[\"/models/lora-a\", \"/models/lora-b\"]'","handlingStrategy":"type-guard","validationCode":"def valid_lora_item(x):\n    return isinstance(x, str) or (isinstance(x, dict) and isinstance(x.get('lora_name'), str) and isinstance(x.get('lora_path'), str))\nassert all(valid_lora_item(i) for i in lora_paths_list)","typeGuard":"def is_lora_item(x) -> bool:\n    return isinstance(x, (str, dict))","tryCatchPattern":null,"preventionTips":["Build --lora-paths from typed Python structures and json.dumps them","Never concatenate raw user input into the JSON list"],"tags":["sglang","lora","cli-parsing","type-validation"],"backgroundTag":"invalid-list-item-type","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}