{"record":{"id":"8cc4fb5475bad5c2","repo":"sgl-project/sglang","slug":"component-residency-selector-cannot-be-empty","errorCode":null,"errorMessage":"Component residency selector cannot be empty","messagePattern":"Component residency selector cannot be empty","errorType":"validation","errorClass":"ComponentResidencyError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/managers/memory_managers/component_residency.py","lineNumber":91,"sourceCode":"                    raise ComponentResidencyError(\n                        \"Component residency must use COMPONENT=MODE, got \"\n                        f\"{assignment!r}\"\n                    )\n                selector, mode = assignment.split(\"=\", 1)\n                parsed_entries.append((selector, mode))\n        entries = parsed_entries\n\n    normalized: dict[str, str] = {}\n    for raw_selector, raw_mode in entries:\n        if not isinstance(raw_selector, str) or not isinstance(raw_mode, str):\n            raise ComponentResidencyError(\n                \"Invalid component residency assignment: \"\n                f\"{raw_selector!r}={raw_mode!r}\"\n            )\n        selector = raw_selector.strip().replace(\"-\", \"_\").lower()\n        mode = raw_mode.strip().replace(\"_\", \"-\").lower()\n        if not selector:\n            raise ComponentResidencyError(\n                \"Component residency selector cannot be empty\"\n            )\n        if mode not in COMPONENT_RESIDENCY_MODES:\n            expected = \", \".join(sorted(COMPONENT_RESIDENCY_MODES))\n            raise ComponentResidencyError(\n                f\"Invalid component residency mode {raw_mode!r} for \"\n                f\"{selector!r}; expected one of: {expected}\"\n            )\n        normalized[selector] = mode\n\n    return normalized or None\n\n\ndef component_residency_selector_matches(component_name: str, selector: str) -> bool:\n    if selector == LAYERWISE_OFFLOAD_ALL_COMPONENTS:\n        return True\n    if selector == LAYERWISE_OFFLOAD_DIT_GROUP:\n        return is_dit_component_name(component_name)","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/managers/memory_managers/component_residency.py#L73-L109","documentation":"After stripping and normalization (hyphens to underscores), a component selector that becomes empty — e.g. \"\", \"-\", \"_\" — is rejected because it would match nothing meaningfully.","triggerScenarios":"An assignment like \"=cpu\", \"-=cpu\", or a comma-only string \",,\" that yields an empty selector before '='.","commonSituations":"Malformed shell quoting producing an empty token; programmatic string building joining empty parts; stray \"=mode\" entries after removing a component name.","solutions":["Provide a real component or group selector before '='","Audit the residency string for empty tokens between commas"],"exampleFix":"# before\n--component-residency =cpu\n# after\n--component-residency vit=cpu","handlingStrategy":"validation","validationCode":"for tok in s.split(\",\"):\n    sel = tok.split(\"=\", 1)[0].strip().replace(\"-\", \"_\").lower()\n    if tok.strip() and (\"=\" not in tok or not sel):\n        raise SystemExit(f\"empty selector in {tok!r}\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Shell-quote residency strings to avoid empty tokens from word splitting"],"tags":["config","component-residency","parsing","empty-value"],"backgroundTag":"invalid-config-value","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}