{"record":{"id":"009749e9d3bcc116","repo":"sgl-project/sglang","slug":"minimax-h3-task-must-be-a-non-empty-string","errorCode":null,"errorMessage":"MiniMax H3 task must be a non-empty string","messagePattern":"MiniMax H3 task 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/task_profiles.py","lineNumber":51,"sourceCode":"    {\n        \"t2va\": \"fl2va\",\n        \"fl2va\": \"fl2va\",\n        \"ref2va\": \"ref2va\",\n    }\n)\n\n\ndef canonical_minimax_h3_task(task: str) -> str:\n    \"\"\"Normalize a public task name (no aliases are currently defined).\"\"\"\n\n    return task\n\n\ndef partition_for_task(task: str) -> str:\n    \"\"\"Return the deployment partition serving *task*.\"\"\"\n\n    if not isinstance(task, str) or not task.strip():\n        raise ValueError(\"MiniMax H3 task must be a non-empty string\")\n    normalized = task.strip().lower()\n    try:\n        return MINIMAX_H3_TASK_PARTITIONS[normalized]\n    except KeyError as exc:\n        raise ValueError(f\"unsupported MiniMax H3 task {task!r}\") from exc\n\n\nMINIMAX_H3_FINITE_ASPECT_RATIOS = (\n    \"21:9\",\n    \"16:9\",\n    \"4:3\",\n    \"1:1\",\n    \"3:4\",\n    \"9:16\",\n)\n\n# ``fl2va`` remains the single public task name for all keyframe variants:\n# first-frame-only, last-frame-only, and first+last.  Keep the accepted","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/task_profiles.py#L33-L69","documentation":"partition_for_task validates its task argument: it must be a Python str (not None or another type) and must contain non-whitespace content. This is the first gate before task normalization and partition lookup, so non-string or blank inputs fail fast with a clear message.","triggerScenarios":"Calling partition_for_task(None), partition_for_task(''), partition_for_task('   '), or passing an int/dict instead of a string. Also hit when the task comes from an unvalidated config field that defaults to None.","commonSituations":"Reading task from CLI args or YAML config where it was omitted; a caller passing task.get('task') on a dict without the key; API requests missing the task field.","solutions":["Set a valid task string (e.g. 't2va', 'fl2va', 'ref2va') in your config/request","Default the field explicitly instead of leaving it None","Strip/validate user input before passing it to partition_for_task"],"exampleFix":"# before\ntask = config.get(\"task\")\npartition = partition_for_task(task)\n\n# after\ntask = (config.get(\"task\") or \"\").strip().lower()\nif not task:\n    raise ValueError(\"config must set 'task'\")\npartition = partition_for_task(task)","handlingStrategy":"validation","validationCode":"task = (raw_task or \"\").strip() if isinstance(raw_task, str) else \"\"\nif not task:\n    raise ValueError(\"'task' must be a non-empty string\")\npartition = partition_for_task(task)","typeGuard":"def is_nonempty_task(task: Any) -> bool:\n    return isinstance(task, str) and bool(task.strip())","tryCatchPattern":"catch ValueError around partition_for_task and map it to a 400-level config error","preventionTips":["Make 'task' a required field in config schemas","Normalize task input at the API boundary"],"tags":["minimax-h3","task-validation","invalid-argument"],"backgroundTag":"missing-required-parameter","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}