{"record":{"id":"d52731aed9be041a","repo":"sgl-project/sglang","slug":"condition-uri-must-be-a-non-empty-string","errorCode":null,"errorMessage":"condition URI must be a non-empty string","messagePattern":"condition URI must be a non-empty string","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/material_io.py","lineNumber":777,"sourceCode":"\n\ndef minimax_h3_localize_material_uri(\n    batch: Any,\n    uri: str,\n    *,\n    condition_type: str,\n    condition_index: int,\n    timeout_s: float = 120.0,\n) -> str:\n    \"\"\"Return a local path for a canonical condition URI.\n\n    Local paths and local ``file://`` URIs are validated and returned without\n    copying. HTTP(S), base64/data and direct tar-member URIs are materialized\n    once per request and cached for all MiniMax H3 consumers.\n    \"\"\"\n\n    if not isinstance(uri, str) or not uri:\n        raise ValueError(\"condition URI must be a non-empty string\")\n    parsed = None\n    for special_scheme in (\"data\", \"base64\", \"tar+offset\", \"tar+b64header\"):\n        if uri.startswith(special_scheme + \":\"):\n            scheme = special_scheme\n            break\n    else:\n        parsed = urllib.parse.urlsplit(uri)\n        scheme = parsed.scheme\n\n    if scheme == \"file\":\n        assert parsed is not None\n        if parsed.netloc not in {\"\", \"localhost\"}:\n            raise ValueError(f\"file URI host must be local, got {parsed.netloc!r}\")\n        output_path = _checked_material_file(\n            Path(urllib.parse.unquote(parsed.path)),\n            label=\"MiniMax H3 material source\",\n        )\n        _validate_material_once(batch, uri, output_path, condition_type=condition_type)","sourceCodeStart":759,"sourceCodeEnd":795,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/material_io.py#L759-L795","documentation":"minimax_h3_localize_material_uri requires the URI to be a non-empty str; None, non-string, or '' was passed as the condition material.","triggerScenarios":"Passing None or '' as the URI for a keyframe/reference-video/reference-image condition, or an upstream stage dropping the field.","commonSituations":"Request JSON omitting the media field (parsed to None), default-None model fields passed straight through, prompt template leaving the URI blank.","solutions":["Guard at the request boundary: skip the condition when uri is falsy","Fix the client payload to always include the URI for enabled conditions","Add schema validation requiring URI when the condition type is set"],"exampleFix":"# before\npath = minimax_h3_localize_material_uri(batch, uri=req.image_uri, ...)\n# after\nif not req.image_uri:\n    raise ValueError(\"image condition requires image_uri\")\npath = minimax_h3_localize_material_uri(batch, uri=req.image_uri, ...)","handlingStrategy":"validation","validationCode":"assert isinstance(uri, str) and uri, 'material URI required'","typeGuard":"def is_valid_uri(uri) -> bool:\n    return isinstance(uri, str) and len(uri) > 0","tryCatchPattern":"except ValueError as e: reject request with missing-media error","preventionTips":["Schema-validate request payloads","Skip conditions with no media instead of passing None"],"tags":["validation","minimax-h3","material-uri"],"backgroundTag":"missing-required-parameter","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}