sgl-project/sglang · error · RuntimeError

replica broadcast of batch.extra[{key!r}] got None

Error message

replica broadcast of batch.extra[{key!r}] got None

What it means

In data-parallel replica mode, rank 0 broadcasts batch.extra[key] via broadcast_tensor_dict; a None payload on any rank means the key was absent (or explicitly None) on the source rank. The RuntimeError surfaces the fact that non-owner replicas cannot proceed without the value.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/replica_broadcast.py:38

    group = get_replica_group()
    return int(group.world_size), int(group.rank_in_group)


def minimax_h3_replica_broadcast_extra(batch: Any, key: str) -> None:
    world, rank = minimax_h3_replica_ctx()
    if world <= 1:
        return

    from sglang.multimodal_gen.runtime.distributed.parallel_state import (
        get_replica_group,
    )

    group = get_replica_group()
    payload = {"value": batch.extra.get(key)} if rank == 0 else None
    payload = group.broadcast_tensor_dict(payload, src=0)
    value = payload.get("value") if isinstance(payload, dict) else None
    if value is None:
        raise RuntimeError(f"replica broadcast of batch.extra[{key!r}] got None")
    if rank != 0:
        batch.extra[key] = value


def minimax_h3_replica_broadcast_error(error: str | None) -> str | None:
    world, rank = minimax_h3_replica_ctx()
    if world <= 1:
        return error

    from sglang.multimodal_gen.runtime.distributed.parallel_state import (
        get_replica_group,
    )

    group = get_replica_group()
    return group.broadcast_object(error if rank == 0 else None, src=0)


__all__ = [

View on GitHub (pinned to 0132848349)

Solutions

  1. Make sure the owner rank populates batch.extra[key] before calling minimax_h3_replica_broadcast_extra
  2. Guard: only broadcast keys you know were produced on rank 0; skip the call if batch.extra.get(key) is None on rank 0
  3. Check the replica group is initialized with all ranks and src=0 is the actual producer rank

Example fix

// before
minimax_h3_replica_broadcast_extra(batch, KEY)
// after
if batch.extra.get(KEY) is not None:
    minimax_h3_replica_broadcast_extra(batch, KEY)
Defensive patterns

Strategy: validation

Validate before calling

if rank == 0 and batch.extra.get(key) is None:
    raise RuntimeError(f"{key} not produced on rank 0; skip broadcast or fix producer stage")

Try / catch

try:
    minimax_h3_replica_broadcast_extra(batch, key)
except RuntimeError as e:
    if "got None" in str(e):
        handle_missing_extra_on_owner(key)
    else:
        raise

Prevention

When it happens

Trigger: minimax_h3_replica_broadcast_extra is called with a key not present in batch.extra on rank 0, or the tensor-dict broadcast returned a payload whose 'value' is None (broadcast failure or key omission).

Common situations: A stage that only runs on rank 0 (e.g. reference encoding) forgot to set the extra key before broadcast; calling broadcast for a key that was never populated on this pipeline path; NCCL group misconfiguration returning empty dicts.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/4e936e6362e5e6ef. Report an issue: GitHub.