sgl-project/sglang · error · ValueError

task {plan.task!r} cannot carry image.target_canvas material

Error message

task {plan.task!r} cannot carry image.target_canvas materials

What it means

image.target_canvas materials (keyframes) are only legal for fl2va/ref2va tasks. For any other plan.task carrying them, _encode_from_plan raises this ValueError, catching task/material mismatches before they reach the encoder.

Source

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

        """
        from sglang.multimodal_gen.runtime.pipelines_core.stages.model_specific_stages.minimax_h3.presentation import (
            minimax_h3_text_only_ids,
        )

        prompt = plan.prompt
        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"

View on GitHub (pinned to 0132848349)

Solutions

  1. Remove image.target_canvas materials from the plan or change plan.task to fl2va/ref2va so they are consistent
  2. Validate the task/material combination in the request builder before submitting
  3. Check for task string typos (exact match required)
Defensive patterns

Strategy: validation

Validate before calling

has_kf = any(m.material_chain == "image.target_canvas" for m in plan.materials)
assert not has_kf or plan.task in {"fl2va", "ref2va"}, f"task {plan.task} cannot carry keyframes"

Type guard

def task_materials_consistent(plan) -> bool:
    has_kf = any(m.material_chain == "image.target_canvas" for m in plan.materials)
    return not has_kf or plan.task in {"fl2va", "ref2va"}

Prevention

When it happens

Trigger: A plan whose task is e.g. 't2va' or any non-fl2va/ref2va value while plan.materials contains entries with material_chain == 'image.target_canvas'.

Common situations: Request builders attaching keyframe images to text-to-video requests, plan templates copied between tasks, or task field typos ('fl2va ' vs 'fl2va').

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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