{"record":{"id":"0d6ade8e6ea7b450","repo":"sgl-project/sglang","slug":"canonical-request-must-be-a-mapping","errorCode":null,"errorMessage":"canonical request must be a mapping","messagePattern":"canonical request must be a mapping","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/resolved_plan.py","lineNumber":261,"sourceCode":"            shape[\"size_mode\"] = \"deferred\"\n            return shape\n        aspect_ratio = auto_aspect_ratio\n        shape[\"geometry_source\"] = auto_geometry_source or \"policy_default\"\n    ar_w, ar_h = _parse_aspect_ratio(aspect_ratio)\n    shape.update(\n        minimax_h3_resolve_spatial_shape(\n            width=ar_w,\n            height=ar_h,\n            base_short_edge=base_short_edge,\n        )\n    )\n    return shape\n\n\ndef minimax_h3_resolve_plan(canonical: Mapping[str, Any]) -> MiniMaxH3ResolvedPlan:\n    \"\"\"Canonical request (already validated) -> ResolvedPlan.\"\"\"\n    if not isinstance(canonical, Mapping):\n        raise ValueError(\"canonical request must be a mapping\")\n    allowed_keys = {\n        \"schema\",\n        \"task\",\n        \"prompt\",\n        \"conditions\",\n        \"target\",\n        \"seed\",\n        \"flow_shift\",\n        \"audio_flow_shift\",\n    }\n    unknown = set(canonical) - allowed_keys\n    if unknown:\n        raise ValueError(f\"canonical request has unknown fields: {sorted(unknown)}\")\n    for key in (\"schema\", \"task\", \"prompt\", \"conditions\", \"target\"):\n        if key not in canonical:\n            raise ValueError(f\"canonical request missing {key!r}\")\n    profile = minimax_h3_task_profile(str(canonical[\"task\"]))\n    conditions = canonical[\"conditions\"]","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/resolved_plan.py#L243-L279","documentation":"minimax_h3_resolve_plan expects the already-validated canonical request as a Mapping. Passing a JSON string, list, or object without Mapping interface fails this early isinstance check.","triggerScenarios":"Calling minimax_h3_resolve_plan('{\"task\":...}') with a serialized JSON string, a list of requests, or a custom object that is not a collections.abc.Mapping.","commonSituations":"Forgetting json.loads after transport/deserialization; double-encoding the payload; passing the raw HTTP body through.","solutions":["json.loads the payload before calling resolve_plan","Pass the dict produced by minimax_h3_validate_canonical_request directly"],"exampleFix":"# before\nplan = minimax_h3_resolve_plan(raw_json_text)\n# after\nplan = minimax_h3_resolve_plan(json.loads(raw_json_text))","handlingStrategy":"type-guard","validationCode":"from collections.abc import Mapping\ndef is_mapping(v): return isinstance(v, Mapping)","typeGuard":"from collections.abc import Mapping\ndef is_canonical_mapping(v) -> bool: return isinstance(v, Mapping)","tryCatchPattern":"null","preventionTips":["json.loads serialized payloads before calling resolve_plan; pass validator output directly"],"tags":["minimax-h3","type-error","mapping","resolved-plan"],"backgroundTag":"invalid-parameter-type","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}