{"record":{"id":"0e935c2a6876d5bb","repo":"sgl-project/sglang","slug":"minimaxh3ditmodel-forward-requires-kwarg-key-r","errorCode":null,"errorMessage":"MiniMaxH3DiTModel.forward requires kwarg {key!r}","messagePattern":"MiniMaxH3DiTModel\\.forward requires kwarg (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/dits/minimax_h3.py","lineNumber":164,"sourceCode":"    \"video_patch_proj.bias\",\n    \"audio_patch_proj.weight\",\n    \"audio_patch_proj.bias\",\n    \"time_embedder.proj_in.weight\",\n    \"time_embedder.proj_in.bias\",\n    \"time_embedder.proj_out.weight\",\n    \"time_embedder.proj_out.bias\",\n    \"final_layer.video_out.weight\",\n    \"final_layer.video_out.bias\",\n    \"final_layer.audio_out.weight\",\n    \"final_layer.audio_out.bias\",\n)\nMINIMAX_H3_FP32_PARAM_NAMES = frozenset(_MINIMAX_H3_FP32_PARAM_NAMES_IN_MODEL_ORDER)\nMINIMAX_H3_FP32_BUFFER_NAMES = frozenset({\"rope.inv_freq\"})\n\n\ndef _required_kwarg(kwargs: dict[str, Any], key: str) -> Any:\n    if key not in kwargs or kwargs[key] is None:\n        raise ValueError(f\"MiniMaxH3DiTModel.forward requires kwarg {key!r}\")\n    return kwargs[key]\n\n\n# The exhaustive keyword contract of MiniMaxH3DiTModel.forward. Anything not\n# listed here is rejected with a TypeError before any tensor work starts.\n_FORWARD_SUPPORTED_KWARGS = frozenset(\n    {\n        \"x\",\n        \"audio_x\",\n        \"img_position_ids\",\n        \"rope_cache\",\n        \"unique_timesteps\",\n        \"inverse_indices\",\n        \"update_mask\",\n        \"update_audio_mask\",\n        \"token_tags\",\n        \"block_token_tags\",\n        \"block_combined_indices\",","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/dits/minimax_h3.py#L146-L182","documentation":"MiniMaxH3DiTModel.forward enforces an exhaustive keyword contract: every required key must be present and non-None in kwargs. _required_kwarg fetches a key and raises this error when it is missing or None, failing before any tensor work.","triggerScenarios":"Calling model.forward(**kwargs) without one of the contract kwargs (e.g. timestep, img_position_ids, or sequence metadata), or passing it explicitly as None from a pipeline default.","commonSituations":"Custom pipelines or refactored callers dropping a kwarg; optional-looking defaults (None) that are actually required for this model; conditional code paths that skip setting a key for some request types.","solutions":["Read _FORWARD_SUPPORTED_KWARGS / the forward signature and supply every required kwarg with a non-None value","Fix the upstream caller to stop passing None for that key (populate it from request metadata instead of defaulting to None)","Add a pre-flight check in your wrapper that walks required keys and fails with a clearer message"],"exampleFix":"# before\nout = model(hidden_states, encoder_hidden_states=e)\n\n# after\nout = model(hidden_states, encoder_hidden_states=e,\n            timestep=t, img_position_ids=pos_ids)","handlingStrategy":"validation","validationCode":"REQUIRED = ('timestep', 'img_position_ids')  # per _FORWARD_SUPPORTED_KWARGS\nmissing = [k for k in REQUIRED if kwargs.get(k) is None]\nassert not missing, f'missing required kwargs: {missing}'","typeGuard":"def kwargs_complete(kwargs: dict, required: tuple[str, ...]) -> bool:\n    return all(kwargs.get(k) is not None for k in required)","tryCatchPattern":"try: model(**kwargs)\\nexcept ValueError as e: raise PipelineConfigError(str(e)) from e","preventionTips":["Centralize forward kwargs construction in one builder","Never pass None for contract kwargs; assert presence pre-call"],"tags":["missing-argument","forward-contract","minimax-h3","kwargs-validation"],"backgroundTag":"missing-required-argument","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}