sgl-project/sglang · error · ValueError

MiniMaxH3TextEncodingStage direct encode requires a text_enc

Error message

MiniMaxH3TextEncodingStage direct encode requires a text_encoder component

What it means

Direct plan-driven encode needs the text_encoder pipeline component; if the stage was constructed with text_encoder=None (pipeline lacking the component), _encode_from_plan raises before attempting any encode. Unlike error 2427, this fires lazily at encode time rather than in __init__.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/text_encoding.py:275

        keyframes = [
            m for m in plan.materials if m.material_chain == "image.target_canvas"
        ]
        if plan.task in {"fl2va", "ref2va"} and keyframes:
            frame_indices = tuple(material.frame_index for material in keyframes)
            if frame_indices not in MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES:
                raise ValueError(
                    "MiniMax H3 text encoding requires an ordered keyframe signature "
                    f"in {MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES!r}, got "
                    f"{frame_indices!r}"
                )
        elif keyframes:
            raise ValueError(
                f"task {plan.task!r} cannot carry image.target_canvas materials"
            )
        if MINIMAX_H3_TEXT_EMBEDDINGS_EXTRA_KEY in batch.extra:
            return
        if self.text_encoder is None:
            raise ValueError(
                "MiniMaxH3TextEncodingStage direct encode requires a text_encoder "
                "component"
            )
        encode_ids = getattr(self.text_encoder, "encode_ids", None)
        if not callable(encode_ids):
            raise TypeError(
                "MiniMax H3 text_encoder component must expose callable "
                "encode_ids(...) for direct encode (MiniMaxH3Qwen3VLEncoder)"
            )
        if self.tokenizer is None:
            raise ValueError(
                "MiniMaxH3TextEncodingStage direct encode requires a tokenizer component"
            )
        with set_forward_context(current_timestep=0, attn_metadata=None):
            if plan.task == "ref2va":
                embeddings = self._encode_ref2va(
                    batch,
                    plan,

View on GitHub (pinned to 0132848349)

Solutions

  1. Load a pipeline that includes the text_encoder component (MiniMaxH3Qwen3VLEncoder)
  2. Or supply precomputed embeddings via MINIMAX_H3_TEXT_EMBEDDINGS_EXTRA_KEY so the encode path short-circuits
  3. Verify model_index.json declares the text_encoder entry
Defensive patterns

Strategy: validation

Validate before calling

if stage.text_encoder is None and MINIMAX_H3_TEXT_EMBEDDINGS_EXTRA_KEY not in batch.extra:
    raise RuntimeError("load text_encoder component or supply precomputed embeddings")

Prevention

When it happens

Trigger: _encode_from_plan proceeds past the cached-embeddings early return while self.text_encoder is None — stage built without the text_encoder component (optional at construction) and now asked to encode directly.

Common situations: Pipelines intended to consume precomputed embeddings being fed plans without the embeddings extra key; partial model snapshots missing the Qwen3VL encoder subfolder.

Related errors


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