sgl-project/sglang · error · ValueError

Action endpoint requires SamplingParams or ActionSamplingPar

Error message

Action endpoint requires SamplingParams or ActionSamplingParams, got {sampling_params_cls.__name__}

What it means

The generic action endpoint resolves the model's sampling-params class from the scheduler and requires it to be a subclass of SamplingParams or ActionSamplingParams. If the served model registers an incompatible sampling_param_cls, the request is rejected before building params. This guards dispatch in build_action_sampling_params.

Source

Thrown at python/sglang/multimodal_gen/runtime/entrypoints/action/protocol.py:278

    if pipeline_class_name:
        from sglang.multimodal_gen.registry import get_pipeline_config_classes

        config_classes = get_pipeline_config_classes(pipeline_class_name)
        if config_classes is not None:
            _, sampling_params_cls = config_classes
            if issubclass(sampling_params_cls, (SamplingParams, ActionSamplingParams)):
                return sampling_params_cls

    from sglang.multimodal_gen.registry import get_model_info

    model_info = get_model_info(
        model_path,
        backend=backend,
        model_id=model_id,
    )
    sampling_params_cls = model_info.sampling_param_cls
    if not issubclass(sampling_params_cls, (SamplingParams, ActionSamplingParams)):
        raise ValueError(
            "Action endpoint requires SamplingParams or ActionSamplingParams, got "
            f"{sampling_params_cls.__name__}"
        )
    return sampling_params_cls


def _resolve_action_sampling_params_cls(
    server_args: ServerArgs,
) -> type[SamplingParams] | type[ActionSamplingParams]:
    return _resolve_action_sampling_params_cls_cached(
        server_args.model_path,
        getattr(server_args, "backend", None),
        getattr(server_args, "model_id", None),
        getattr(server_args, "pipeline_class_name", None),
    )


@lru_cache(maxsize=32)

View on GitHub (pinned to 0132848349)

Solutions

  1. Serve an action-capable model (e.g. Cosmos3) on this server instance for /v1/actions requests
  2. If integrating a new model, make its sampling params class inherit ActionSamplingParams (or SamplingParams)
  3. Check model_info registration/sampling_param_cls wiring for typos in the model plugin

Example fix

# before
class MyParams(BaseSamplingParams):  # not a subclass
    ...
# after
class MyParams(ActionSamplingParams):
    ...
Defensive patterns

Strategy: fallback

Validate before calling

# before using /v1/actions, confirm the served model supports actions, e.g.
# check the model card / docs; only Cosmos3-class models implement the action endpoint

Try / catch

try:
    params = build_action_sampling_params(payload, obs, server_args, cls)
except ValueError as e:
    if 'Action endpoint requires' in str(e):
        raise RuntimeError('model does not support /v1/actions; serve an action model') from e
    raise

Prevention

When it happens

Trigger: Loading a model whose model_info.sampling_param_cls is neither SamplingParams nor ActionSamplingParams subclass (e.g. a video-only or text-only params class) and POSTing to /v1/actions.

Common situations: Pointing the action endpoint at a non-action model (video generation, standard LLM); model integration registering a custom params class that doesn't inherit from ActionSamplingParams; version skew after a refactor of the class hierarchy.

Related errors


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