{"record":{"id":"7d6603270a2d0361","repo":"sgl-project/sglang","slug":"minimax-h3-text-encoder-component-must-expose-call","errorCode":null,"errorMessage":"MiniMax H3 text_encoder component must expose callable encode_ids(...) for direct encode (MiniMaxH3Qwen3VLEncoder)","messagePattern":"MiniMax H3 text_encoder component must expose callable encode_ids\\(\\.\\.\\.\\) for direct encode \\(MiniMaxH3Qwen3VLEncoder\\)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/text_encoding.py","lineNumber":281,"sourceCode":"                raise ValueError(\n                    \"MiniMax H3 text encoding requires an ordered keyframe signature \"\n                    f\"in {MINIMAX_H3_FL2VA_KEYFRAME_SIGNATURES!r}, got \"\n                    f\"{frame_indices!r}\"\n                )\n        elif keyframes:\n            raise ValueError(\n                f\"task {plan.task!r} cannot carry image.target_canvas materials\"\n            )\n        if MINIMAX_H3_TEXT_EMBEDDINGS_EXTRA_KEY in batch.extra:\n            return\n        if self.text_encoder is None:\n            raise ValueError(\n                \"MiniMaxH3TextEncodingStage direct encode requires a text_encoder \"\n                \"component\"\n            )\n        encode_ids = getattr(self.text_encoder, \"encode_ids\", None)\n        if not callable(encode_ids):\n            raise TypeError(\n                \"MiniMax H3 text_encoder component must expose callable \"\n                \"encode_ids(...) for direct encode (MiniMaxH3Qwen3VLEncoder)\"\n            )\n        if self.tokenizer is None:\n            raise ValueError(\n                \"MiniMaxH3TextEncodingStage direct encode requires a tokenizer component\"\n            )\n        with set_forward_context(current_timestep=0, attn_metadata=None):\n            if plan.task == \"ref2va\":\n                embeddings = self._encode_ref2va(\n                    batch,\n                    plan,\n                    encode_ids,\n                    include_video_token_mask=include_video_token_mask,\n                )\n            elif keyframes:\n                embeddings = self._encode_fl2va_keyframes(\n                    batch,","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/stages/text_encoding.py#L263-L299","documentation":"The direct encode path calls text_encoder.encode_ids(...); if the loaded text_encoder object does not expose a callable encode_ids attribute, this TypeError fires. It guards against wrong encoder classes being installed under the text_encoder slot.","triggerScenarios":"_encode_from_plan does getattr(self.text_encoder, 'encode_ids', None) and the result is not callable — e.g. a plain Qwen3VLModel or a wrapper lacking the MiniMaxH3Qwen3VLEncoder.encode_ids API was used as the component.","commonSituations":"Swapping in a vanilla transformers Qwen3VL encoder instead of the MiniMax H3 wrapper, version skew where encode_ids was renamed, or a mock/stub component in tests.","solutions":["Use MiniMaxH3Qwen3VLEncoder (which exposes encode_ids) as the text_encoder component","Upgrade/downgrade to a consistent sglang version where the encoder wrapper matches this stage","For tests, provide a stub with a callable encode_ids"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"if not callable(getattr(text_encoder, \"encode_ids\", None)):\n    raise TypeError(\"need MiniMaxH3Qwen3VLEncoder, got \" + type(text_encoder).__name__)","typeGuard":"def is_qwen3vl_direct_encoder(enc) -> bool:\n    return callable(getattr(enc, \"encode_ids\", None))","tryCatchPattern":null,"preventionTips":["Install the MiniMax H3 encoder wrapper, not the vanilla transformers model","Pin sglang versions so stage and encoder interfaces match"],"tags":["minimax-h3","duck-typing","text-encoding","type-validation"],"backgroundTag":"incompatible-component-interface","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}