{"record":{"id":"6a6cc10d3505cf91","repo":"sgl-project/sglang","slug":"component-component-name-r-resolved-to-layerwise","errorCode":null,"errorMessage":"Component {component_name!r} resolved to layerwise-offload, but its loaded module did not enable layerwise offload","messagePattern":"Component (.+?) resolved to layerwise-offload, but its loaded module did not enable layerwise offload","errorType":"validation","errorClass":"ComponentResidencyError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/managers/memory_managers/component_manager.py","lineNumber":86,"sourceCode":"    ) -> list[ComponentUse]: ...\n\n\nclass ComponentResidencyPipeline(Protocol):\n    modules: Mapping[str, object]\n    _stage_name_mapping: Mapping[str, ComponentResidencyStage]\n    component_residency_strategies: MutableMapping[str, \"ComponentResidencyStrategy\"]\n\n\ndef build_component_residency_strategy(\n    component_name: str,\n    module: nn.Module,\n    server_args: ServerArgs,\n) -> ComponentResidencyStrategy:\n    residency_mode = server_args.residency_mode(component_name)\n    if is_layerwise_offloaded_module(module):\n        return LayerwiseOffloadStrategy()\n    if residency_mode == LAYERWISE_OFFLOAD:\n        raise ComponentResidencyError(\n            f\"Component {component_name!r} resolved to layerwise-offload, but its \"\n            \"loaded module did not enable layerwise offload\"\n        )\n    if residency_mode == COMPONENT_OFFLOAD and is_fsdp_managed_module(module):\n        raise ComponentResidencyError(\n            f\"Component {component_name!r} resolved to component-offload, but it \"\n            \"was loaded as an FSDP-managed module\"\n        )\n    if (\n        not current_platform.is_mps()\n        and not is_fsdp_managed_module(module)\n        and residency_mode == COMPONENT_OFFLOAD\n    ):\n        return ComponentOffloadStrategy()\n    return ResidentStrategy()\n\n\nclass ComponentResidencyManager:","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/managers/memory_managers/component_manager.py#L68-L104","documentation":"build_component_residency_strategy resolves the residency mode for a component: if the loaded module actually supports layerwise offload it returns a LayerwiseOffloadStrategy regardless of config; but if the config explicitly asked for layerwise-offload and the module was NOT loaded with layerwise offload enabled, it raises ComponentResidencyError.","triggerScenarios":"server_args.residency_mode(name) == LAYERWISE_OFFLOAD while is_layerwise_offloaded_module(module) is False — e.g. setting component residency like \"vit=layerwise-offload\" for a component whose weights were loaded monolithically.","commonSituations":"Enabling layerwise offload for a component (e.g. a VAE or vision tower) that was loaded without the layerwise loading path; changing residency flags without re-loading/re-configuring the module; copying a residency config from a model that supports layerwise to one that does not.","solutions":["Remove or change the layerwise-offload assignment for that component in the residency config","Enable layerwise offload at module-load time so is_layerwise_offloaded_module(module) is true, then retry","Use component-offload or gpu mode for components that do not support layerwise loading"],"exampleFix":"# before\n--component-residency vit=layerwise-offload\n# after\n--component-residency vit=component-offload","handlingStrategy":"validation","validationCode":"from sglang.multimodal_gen.runtime.managers.memory_managers.component_manager import is_layerwise_offloaded_module\nif not is_layerwise_offloaded_module(module):\n    raise SystemExit(\"module not layerwise-loaded; remove layerwise-offload residency for it\")","typeGuard":"def can_use_layerwise(module) -> bool:\n    return is_layerwise_offloaded_module(module)","tryCatchPattern":null,"preventionTips":["Match residency mode to how the module was actually loaded, not just to intent","Re-verify residency configs after upgrading, since module loading paths change"],"tags":["memory","offload","config","component-residency","startup"],"backgroundTag":"unsupported-config-for-capability","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}