sgl-project/sglang · error · ValueError
Missing tensor payload for module(s)
Error message
Missing tensor payload for module(s): {missing}. Provided modules: {list(named_tensors.keys())} What it means
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.
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
Example fix
// before
updater.update_weights_from_tensor(named_tensors={"encoder": enc_tensors}, target_modules=["encoder","decoder"])
// after
updater.update_weights_from_tensor(named_tensors={"encoder": enc_tensors, "decoder": dec_tensors}, target_modules=["encoder","decoder"]) Defensive patterns
Strategy: validation
Validate before calling
missing = [m for m in target_modules if m not in named_tensors]
if missing: raise KeyError(f"payload missing {missing}") Type guard
def has_all_payloads(named_tensors: dict, modules: list[str]) -> bool:
return isinstance(named_tensors, dict) and all(m in named_tensors for m in modules) Prevention
- Build named_tensors from the same list used for target_modules so they cannot diverge
- Assert payload keys == target module names before calling
When it happens
Trigger: 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.
Common situations: Adding a new module to target_modules without extending the payload dict; key typos; partial checkpoint serialization that skipped one module's tensors.
Related errors
- Ambiguous tensor payload for multi-module update. Provide a…
- flattened_bucket payload must be a dict with…
- Module(s) requested for update not found in pipeline
- Unsupported module payload type for load_format=
- batching config rule requires max_batch_size
AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28).
Data as JSON: /api/errors/1785a962b1e96019.
Report an issue: GitHub.
Appendix: source
Thrown at python/sglang/multimodal_gen/runtime/post_training/weights_updater.py:750
)
message = (
f"Updated {updated} LoRA layers in {target_module} from IPC tensors "
f"(skipped {skipped} unknown layers)."
)
logger.info(message)
return True, message
def _resolve_module_payloads(
self,
named_tensors: Any,
modules_to_update: list[tuple[str, torch.nn.Module]],
) -> dict[str, Any]:
module_names = [name for name, _ in modules_to_update]
if isinstance(named_tensors, dict):
missing = [name for name in module_names if name not in named_tensors]
if missing:
raise ValueError(
f"Missing tensor payload for module(s): {missing}. "
f"Provided modules: {list(named_tensors.keys())}"
)
return {name: named_tensors[name] for name in module_names}
if len(module_names) == 1:
return {module_names[0]: named_tensors}
raise ValueError(
"Ambiguous tensor payload for multi-module update. "
"Provide a dict mapping module_name -> module payload, "
f"requested modules: {module_names}."
)
def _materialize_weights_iter(self, module_payload: Any, load_format: str | None):
if load_format == "flattened_bucket":
if not isinstance(module_payload, dict):
raise ValueError(View on GitHub (pinned to 0132848349)