{"record":{"id":"1785a962b1e96019","repo":"sgl-project/sglang","slug":"missing-tensor-payload-for-module-s-missing-p","errorCode":null,"errorMessage":"Missing tensor payload for module(s): {missing}. Provided modules: {list(named_tensors.keys())}","messagePattern":"Missing tensor payload for module\\(s\\): (.+?)\\. Provided modules: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/post_training/weights_updater.py","lineNumber":750,"sourceCode":"            )\n\n        message = (\n            f\"Updated {updated} LoRA layers in {target_module} from IPC tensors \"\n            f\"(skipped {skipped} unknown layers).\"\n        )\n        logger.info(message)\n        return True, message\n\n    def _resolve_module_payloads(\n        self,\n        named_tensors: Any,\n        modules_to_update: list[tuple[str, torch.nn.Module]],\n    ) -> dict[str, Any]:\n        module_names = [name for name, _ in modules_to_update]\n        if isinstance(named_tensors, dict):\n            missing = [name for name in module_names if name not in named_tensors]\n            if missing:\n                raise ValueError(\n                    f\"Missing tensor payload for module(s): {missing}. \"\n                    f\"Provided modules: {list(named_tensors.keys())}\"\n                )\n            return {name: named_tensors[name] for name in module_names}\n\n        if len(module_names) == 1:\n            return {module_names[0]: named_tensors}\n\n        raise ValueError(\n            \"Ambiguous tensor payload for multi-module update. \"\n            \"Provide a dict mapping module_name -> module payload, \"\n            f\"requested modules: {module_names}.\"\n        )\n\n    def _materialize_weights_iter(self, module_payload: Any, load_format: str | None):\n        if load_format == \"flattened_bucket\":\n            if not isinstance(module_payload, dict):\n                raise ValueError(","sourceCodeStart":732,"sourceCodeEnd":768,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/post_training/weights_updater.py#L732-L768","documentation":"Raised by WeightsUpdater._resolve_module_payloads when named_tensors is a dict but one or more modules selected for update has no corresponding key in the dict. Each module being updated must have an entry in the payload mapping.","triggerScenarios":"Calling update_weights_from_tensor with named_tensors={'encoder': ...} while the updater resolves two modules (e.g. target_modules=['encoder','decoder']) — 'decoder' is missing so the error fires.","commonSituations":"Adding a new module to target_modules without extending the payload dict; key typos; partial checkpoint serialization that skipped one module's tensors.","solutions":["Add the missing module's tensor payload under exactly the name listed in 'missing'","Or restrict target_modules to only the modules you actually have payloads for"],"exampleFix":"// before\nupdater.update_weights_from_tensor(named_tensors={\"encoder\": enc_tensors}, target_modules=[\"encoder\",\"decoder\"])\n// after\nupdater.update_weights_from_tensor(named_tensors={\"encoder\": enc_tensors, \"decoder\": dec_tensors}, target_modules=[\"encoder\",\"decoder\"])","handlingStrategy":"validation","validationCode":"missing = [m for m in target_modules if m not in named_tensors]\nif missing: raise KeyError(f\"payload missing {missing}\")","typeGuard":"def has_all_payloads(named_tensors: dict, modules: list[str]) -> bool:\n    return isinstance(named_tensors, dict) and all(m in named_tensors for m in modules)","tryCatchPattern":null,"preventionTips":["Build named_tensors from the same list used for target_modules so they cannot diverge","Assert payload keys == target module names before calling"],"tags":["weights-update","payload","validation","multimodal"],"backgroundTag":"missing-dict-key","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}