sgl-project/sglang · error · RuntimeError

PD state transfer failed: unknown state_type={st}

Error message

PD state transfer failed: unknown state_type={st}

What it means

send_state dispatches each state component by its state_type string (e.g. 'mamba', 'swa', 'c128_state', 'minimax_index_k'); an unrecognized value falls through to this error. It indicates a state type the transfer layer has no sender implementation for — usually a newer/unsupported type or a typo in the backend's declaration.

Source

Thrown at python/sglang/srt/disaggregation/mori/conn.py:1263

                        dst_lens,
                        src_dims,
                        dst_dims,
                    )
                )
            elif st in ("swa", "dsa", "swa_ring", "c128_state", "minimax_index_k"):
                statuses.extend(
                    self._send_swa_dsa_state(
                        peer_info,
                        src_indices,
                        dst_indices,
                        src_descs,
                        src_lens,
                        dst_descs,
                        st,
                    )
                )
            else:
                raise RuntimeError(f"PD state transfer failed: unknown state_type={st}")

        return statuses

    def _send_mamba_state(
        self,
        peer_info: KVArgsRegisterInfo,
        src_state_indices: npt.NDArray[np.int32],
        dst_state_indices: npt.NDArray[np.int32],
        src_state_mem_descs: List[MemoryDesc],
        dst_state_mem_descs: List[MemoryDesc],
        src_state_item_lens: List[int],
        dst_state_item_lens: List[int],
        src_state_dim_per_tensor: List[int],
        dst_state_dim_per_tensor: List[int],
    ) -> List[TransferStatus]:
        if src_state_indices.size != 1 or dst_state_indices.size != 1:
            raise RuntimeError(
                f"PD state transfer failed: mamba requires single state index, "

View on GitHub (pinned to 0132848349)

Solutions

  1. Check which state_type string is being sent (log kv_args.state_types) and map it to a supported one ('mamba', 'swa', etc.)
  2. Update SGLang to a version whose conn.py supports your backend's state types, or add a sender branch for the new type
  3. If the state type is not needed for decode, remove it from kv_args.state_types and its descriptors
Defensive patterns

Strategy: type-guard

Type guard

SUPPORTED_STATE_TYPES = {"mamba", "swa", "c128_state", "minimax_index_k"}

def is_supported_state_type(st: str) -> bool:
    return st in SUPPORTED_STATE_TYPES

Prevention

When it happens

Trigger: An attention backend populates kv_args.state_types with a string not handled by the if/elif chain in send_state, then a request triggers _submit_kv_transfer for that layer.

Common situations: Using a custom or newer hybrid attention backend whose state_type strings are not covered by this Mori conn implementation, or a renamed state type after an upgrade.

Related errors


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