{"record":{"id":"beb0b6eb7c6cb022","repo":"sgl-project/sglang","slug":"missing-order-as-a-required-keyword-argument-beb0b6","errorCode":null,"errorMessage":"missing `order` as a required keyword argument","messagePattern":"missing `order` as a required keyword argument","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/models/schedulers/scheduling_unipc_multistep.py","lineNumber":815,"sourceCode":"                A current instance of a sample created by the diffusion process.\n            order (`int`):\n                The order of UniP at this timestep (corresponds to the *p* in UniPC-p).\n\n        Returns:\n            `torch.Tensor`:\n                The sample tensor at the previous timestep.\n        \"\"\"\n        prev_timestep = args[0] if len(args) > 0 else kwargs.pop(\"prev_timestep\", None)\n        if sample is None:\n            if len(args) > 1:\n                sample = args[1]\n            else:\n                raise ValueError(\"missing `sample` as a required keyword argument\")\n        if order is None:\n            if len(args) > 2:\n                order = args[2]\n            else:\n                raise ValueError(\"missing `order` as a required keyword argument\")\n        if prev_timestep is not None:\n            deprecate(\n                \"prev_timestep\",\n                \"1.0.0\",\n                \"Passing `prev_timestep` is deprecated and has no effect as model output conversion is now handled via an internal counter `self.step_index`\",\n            )\n        model_output_list = self.model_outputs\n\n        s0 = self.timestep_list[-1]\n        m0 = model_output_list[-1]\n        x = sample\n\n        if self.solver_p:\n            x_t = self.solver_p.step(model_output, s0, x).prev_sample\n            return x_t\n\n        sigma_t, sigma_s0 = (\n            self.sigmas[self.step_index + 1],","sourceCodeStart":797,"sourceCodeEnd":833,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/models/schedulers/scheduling_unipc_multistep.py#L797-L833","documentation":"multistep_uni_p_bh_update requires the solver `order` (number of correction history terms); if not supplied as the third positional arg or keyword, the B(h) polynomial loop bound is unknown.","triggerScenarios":"Calling multistep_uni_p_bh_update(model_output, sample) with only two args and no order keyword.","commonSituations":"Direct internal API calls ported from older versions with a different arity; step() computes order from self.step_index and passes it, so this only affects manual calls.","solutions":["Call scheduler.step() instead","Pass order explicitly, typically min(self.step_index + 1, solver_order)"],"exampleFix":"// before\nsched.multistep_uni_p_bh_update(model_output, sample)\n// after\norder = min(sched.step_index + 1, sched.config.solver_order)\nprev = sched.multistep_uni_p_bh_update(model_output, sample, order)","handlingStrategy":"validation","validationCode":"assert order is not None and order >= 1","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Compute order as min(step_index + 1, solver_order) when calling the predictor manually"],"tags":["scheduler","diffusion","api-misuse","unipc"],"backgroundTag":"missing-required-argument","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}