{"record":{"id":"df305c6be35b2377","repo":"sgl-project/sglang","slug":"invalid-layerwise-offload-component-name-raw-com","errorCode":null,"errorMessage":"Invalid layerwise offload component name: {raw_component}.","messagePattern":"Invalid layerwise offload component name: (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/managers/memory_managers/layerwise_offload_components.py","lineNumber":203,"sourceCode":"def expand_layerwise_offload_component_group(component_name: str) -> tuple[str, ...]:\n    if component_name == LAYERWISE_OFFLOAD_DEFAULT_GROUP:\n        return LAYERWISE_OFFLOAD_DEFAULT_GROUP_COMPONENTS\n    return (component_name,)\n\n\ndef normalize_layerwise_offload_components(\n    component_names: str | Sequence[str] | None,\n) -> list[str] | None:\n    if component_names is None:\n        return None\n\n    raw_components = (\n        [component_names] if isinstance(component_names, str) else component_names\n    )\n    normalized_components: list[str] = []\n    for raw_component in raw_components:\n        if not isinstance(raw_component, str):\n            raise ValueError(\n                f\"Invalid layerwise offload component name: {raw_component}.\"\n            )\n        for component_name in raw_component.split(\",\"):\n            component_name = component_name.strip().replace(\"-\", \"_\").lower()\n            if not component_name:\n                continue\n            for expanded_component_name in expand_layerwise_offload_component_group(\n                component_name\n            ):\n                if expanded_component_name == LAYERWISE_OFFLOAD_ALL_COMPONENTS:\n                    return [LAYERWISE_OFFLOAD_ALL_COMPONENTS]\n                if expanded_component_name not in normalized_components:\n                    normalized_components.append(expanded_component_name)\n\n    return normalized_components or None\n","sourceCodeStart":185,"sourceCodeEnd":219,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/managers/memory_managers/layerwise_offload_components.py#L185-L219","documentation":"Raised by normalize_layerwise_offload_components when an element of the layerwise-offload component list is not a string. The API accepts a single string or a list of strings (each optionally comma-separated), and any non-string element (int, None, enum) is rejected before normalization.","triggerScenarios":"Calling configure_layerwise_offload_modules / get_layerwise_offload_component_names_for_pipeline / residency_mode with a list containing non-str entries, e.g. component_names=[None, 'dit', 3] or passing an enum/config object instead of its string name.","commonSituations":"Config files (YAML/JSON) where the component field is parsed as int/bool/null, or passing a config dataclass attribute directly instead of the string name; also passing a tuple of mixed types.","solutions":["Ensure every element of component_names is a str, e.g. [str(c) for c in component_names]","Fix the config source: quote the component names in YAML/JSON so they parse as strings","If passing an enum, use its .value"],"exampleFix":"// before\nconfigure_layerwise_offload_modules([None, \"dit\"])\n// after\nconfigure_layerwise_offload_modules([\"dit\"])","handlingStrategy":"type-guard","validationCode":"components = [c for c in raw_components if c is not None]\nassert all(isinstance(c, str) for c in components), components","typeGuard":"def is_component_list(v) -> TypeGuard[list[str]]:\n    return isinstance(v, list) and all(isinstance(x, str) for x in v)","tryCatchPattern":null,"preventionTips":["Quote component names in YAML/JSON configs","Convert enums with .value before passing","Str-coerce lists: [str(c) for c in component_names]"],"tags":["config-validation","layerwise-offload","type-error"],"backgroundTag":"invalid-argument-type","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}