sgl-project/sglang · error · ValueError

unknown minimax_h3 task {task!r}; supported: {sorted(MINIMAX

Error message

unknown minimax_h3 task {task!r}; supported: {sorted(MINIMAX_H3_TASK_PROFILES)}

What it means

minimax_h3_task_profile looks the task up in the MINIMAX_H3_TASK_PROFILES registry by exact string match (no normalization). An unknown task raises ValueError listing the supported task names. This is the entry point used by request validation and plan resolution.

Source

Thrown at python/sglang/multimodal_gen/runtime/pipelines_core/stages/model_specific_stages/minimax_h3/task_profiles.py:248

        required_components=_BASE_COMPONENTS,
        # ref2va video may use an explicit aspect ratio such as "7:4":
        # ref2va allows explicit aspect ratios; "auto" falls back to the
        # policy default (references never bind target geometry).
        aspect_ratio_forced_auto=False,
        geometry_source="explicit_target",
        duration_from_audio_reference=True,
        auto_aspect_ratio="16:9",
        auto_geometry_source="policy_default",
        # ref2va video uses a subject image plus a reference video with soundtrack.
        video_reference_supported=True,
    ),
}


def minimax_h3_task_profile(task: str) -> MiniMaxH3TaskProfile:
    profile = MINIMAX_H3_TASK_PROFILES.get(task)
    if profile is None:
        raise ValueError(
            f"unknown minimax_h3 task {task!r}; supported: "
            f"{sorted(MINIMAX_H3_TASK_PROFILES)}"
        )
    return profile


def _validate_profiles() -> None:
    for task, profile in MINIMAX_H3_TASK_PROFILES.items():
        if profile.task != task:
            raise ValueError(f"profile key/task mismatch: {task} vs {profile.task}")
        rule_keys = [
            (rule.role, rule.condition_type) for rule in profile.condition_rules
        ]
        if len(rule_keys) != len(set(rule_keys)):
            raise ValueError(f"task {task}: condition rules must be unique")
        if profile.min_condition_count is not None and profile.min_condition_count <= 0:
            raise ValueError(f"task {task}: min_condition_count must be positive")
        if profile.max_condition_count is not None and profile.max_condition_count <= 0:

View on GitHub (pinned to 0132848349)

Solutions

  1. Use the exact canonical task key; print sorted(MINIMAX_H3_TASK_PROFILES) to list them
  2. Normalize (strip/lower) task strings before calling, since this function does exact-match lookup
  3. Validate the task early with canonical_task to get the normalized form

Example fix

# before
minimax_h3_task_profile("T2VA")

# after
from ...task_profiles import canonical_task
minimax_h3_task_profile(canonical_task("T2VA"))  # -> "t2va"
Defensive patterns

Strategy: validation

Validate before calling

from ...task_profiles import MINIMAX_H3_TASK_PROFILES, canonical_task
canonical = canonical_task(task)
if canonical not in MINIMAX_H3_TASK_PROFILES:
    raise ValueError(f"unknown task; supported: {sorted(MINIMAX_H3_TASK_PROFILES)}")

Type guard

def is_known_task(task: str) -> bool:
    from ...task_profiles import MINIMAX_H3_TASK_PROFILES
    return task in MINIMAX_H3_TASK_PROFILES

Try / catch

catch ValueError from minimax_h3_task_profile and return the supported list in the error response

Prevention

When it happens

Trigger: Calling minimax_h3_validate_canonical_request or minimax_h3_resolve_plan with a task string that isn't an exact key of MINIMAX_H3_TASK_PROFILES — including case mismatches like 'T2VA' (this function does not lowercase, unlike partition_for_task) or whitespace-padded strings.

Common situations: Passing an uppercase or padded task from user input directly; using a task alias that exists in the partition table but not in the profile registry; typo'd task names.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/ba8a05ff5179268c. Report an issue: GitHub.