sgl-project/sglang · error · ValueError

missing `this_sample` as a required keyword argument

Error message

missing `this_sample` as a required keyword argument

What it means

multistep_uni_c_bh_update also requires `this_sample` (the current-step sample) as the third positional arg or keyword; without it the corrector update cannot be computed.

Source

Thrown at python/sglang/multimodal_gen/runtime/models/schedulers/scheduling_unipc_multistep.py:950

                The generated sample after the last predictor `x_{t}`.
            order (`int`):
                The `p` of UniC-p at this step. The effective order of accuracy should be `order + 1`.

        Returns:
            `torch.Tensor`:
                The corrected sample tensor at the current timestep.
        """
        this_timestep = args[0] if len(args) > 0 else kwargs.pop("this_timestep", None)
        if last_sample is None:
            if len(args) > 1:
                last_sample = args[1]
            else:
                raise ValueError("missing `last_sample` as a required keyword argument")
        if this_sample is None:
            if len(args) > 2:
                this_sample = args[2]
            else:
                raise ValueError("missing `this_sample` as a required keyword argument")
        if order is None:
            if len(args) > 3:
                order = args[3]
            else:
                raise ValueError("missing `order` as a required keyword argument")
        if this_timestep is not None:
            deprecate(
                "this_timestep",
                "1.0.0",
                "Passing `this_timestep` is deprecated and has no effect as model output conversion is now handled via an internal counter `self.step_index`",
            )

        model_output_list = self.model_outputs

        m0 = model_output_list[-1]
        x = last_sample
        x_t = this_sample
        model_t = this_model_output

View on GitHub (pinned to 0132848349)

Solutions

  1. Use scheduler.step() instead
  2. Pass this_sample as the third positional argument or keyword

Example fix

// before
sched.multistep_uni_c_bh_update(model_output, last_sample)
// after
sched.multistep_uni_c_bh_update(model_output, last_sample, this_sample, order)
Defensive patterns

Strategy: validation

Validate before calling

assert this_sample is not None

Prevention

When it happens

Trigger: Calling multistep_uni_c_bh_update(model_output, last_sample) with this_sample omitted.

Common situations: Partial port of an old two-argument call signature when the corrector historically had fewer parameters.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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