{"record":{"id":"5e9bffa3a3ee64f7","repo":"sgl-project/sglang","slug":"path-is-required-and-must-be-an-object","errorCode":null,"errorMessage":"{path} is required and must be an object","messagePattern":"(.+?) is required and must be an object","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/request_validation.py","lineNumber":83,"sourceCode":"        raise ValueError(f\"{path} must be a positive finite number\")\n    return normalized\n\n\ndef _optional_nonnegative_finite_float(value: Any, path: str) -> float | None:\n    if value is None:\n        return None\n    if isinstance(value, bool) or not isinstance(value, (int, float)):\n        raise ValueError(f\"{path} must be a number\")\n    normalized = float(value)\n    if not math.isfinite(normalized) or normalized < 0.0:\n        raise ValueError(f\"{path} must be a non-negative finite number\")\n    return normalized\n\n\ndef _validate_target(target: Any, *, profile: MiniMaxH3TaskProfile) -> dict[str, Any]:\n    path = \"target\"\n    if not isinstance(target, Mapping):\n        raise ValueError(f\"{path} is required and must be an object\")\n    # The canonical target has a deliberately small projection.  Transport\n    # compatibility keys are ignored; only these three declared values are\n    # validated and emitted below.\n    short_edge = _require_int(target.get(\"short_edge\"), f\"{path}.short_edge\")\n    if short_edge <= 0:\n        raise ValueError(f\"{path}.short_edge must be positive, got {short_edge}\")\n    if short_edge != MINIMAX_H3_RECOMMENDED_SHORT_EDGE:\n        # Same guard the resolver applies. Without it the recommended value warns\n        # that it is \"outside the verified configuration\", naming itself as the\n        # verified one.\n        warn_unverified_short_edge(short_edge)\n    aspect_ratio = _require_str(target.get(\"aspect_ratio\"), f\"{path}.aspect_ratio\")\n    if profile.aspect_ratio_forced_auto and aspect_ratio != \"auto\":\n        raise ValueError(\n            f'{path}.aspect_ratio must be \"auto\" for task {profile.task!r}, '\n            f\"got {aspect_ratio!r}\"\n        )\n    has_duration = target.get(\"duration_seconds\") is not None","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/request_validation.py#L65-L101","documentation":"The canonical request's top-level target must be a Mapping (JSON object). A missing target (None), a list, or a scalar raises this error before any field validation inside _validate_target.","triggerScenarios":"Calling minimax_h3_validate_canonical_request with a request dict lacking 'target', or with target set to a string/number/array.","commonSituations":"Clients flattening target fields to top level, or a transport dropping the nested object; also None from optional-key handling code.","solutions":["Include target as a nested object: {\"target\": {\"short_edge\": ..., \"uri\": ...}}","Fix serializers that flatten or drop the nested object","Check the canonical request schema before submitting"],"exampleFix":"# before\n{\"short_edge\": 512}\n# after\n{\"target\": {\"short_edge\": 512}}","handlingStrategy":"type-guard","validationCode":"from collections.abc import Mapping\nassert isinstance(req.get(\"target\"), Mapping), \"target is required and must be an object\"","typeGuard":"from collections.abc import Mapping\ndef has_target(req: Any) -> bool:\n    return isinstance(req, Mapping) and isinstance(req.get(\"target\"), Mapping)","tryCatchPattern":null,"preventionTips":["Build requests from a typed schema with a nested target model","Add a JSON-schema check in client integration tests"],"tags":["minimax-h3","request-validation","target-object","canonical-request"],"backgroundTag":"schema-validation-failed","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}