{"record":{"id":"80ff00631d5182e0","repo":"sgl-project/sglang","slug":"generate-action-requires-an-action-pipeline-got","errorCode":null,"errorMessage":"generate_action requires an ACTION pipeline, got {sampling_params.data_type}","messagePattern":"generate_action requires an ACTION pipeline, got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/entrypoints/diffusion_generator.py","lineNumber":460,"sourceCode":"        self._log_summary(results)\n\n        if not results:\n            return None\n        return results[0] if len(results) == 1 else results\n\n    def generate_action(\n        self,\n        sampling_params_kwargs: dict | None = None,\n        external_trace_header: dict[str, str] | None = None,\n    ) -> dict[str, Any]:\n        sampling_params_kwargs = sampling_params_kwargs or {}\n        sampling_params = SamplingParams.from_user_sampling_params_args(\n            self.server_args.model_path,\n            server_args=self.server_args,\n            **sampling_params_kwargs,\n        )\n        if sampling_params.data_type != DataType.ACTION:\n            raise ValueError(\n                f\"generate_action requires an ACTION pipeline, got {sampling_params.data_type}\"\n            )\n\n        req = prepare_request(\n            server_args=self.server_args,\n            sampling_params=sampling_params,\n            external_trace_header=external_trace_header,\n        )\n        output_batch = self._send_to_scheduler_and_wait_for_response(req)\n        if output_batch.error:\n            raise RuntimeError(output_batch.error)\n        if output_batch.output is None:\n            raise RuntimeError(\"action policy returned no output\")\n        return output_batch.output[0]\n\n    def _resolve_prompts(\n        self,\n        prompt: str | list[str] | None,","sourceCodeStart":442,"sourceCodeEnd":478,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/entrypoints/diffusion_generator.py#L442-L478","documentation":"DiffusionGenerator.generate_action validates that the resolved SamplingParams have data_type == DataType.ACTION. If the server/args were configured for another pipeline (e.g. image/video generation), action-specific generation cannot proceed and this ValueError is raised before a request is built.","triggerScenarios":"Calling generate_action() against a server whose server_args/data_type resolve to a non-ACTION data type; omitting the data_type argument so it defaults to the server's configured pipeline type.","commonSituations":"Reusing a DiffusionGenerator initialized for image generation to also drive an action policy; forgetting to pass data_type=DataType.ACTION or the corresponding --data-type flag when launching the action pipeline.","solutions":["Initialize/launch with the ACTION data type (e.g. pass data_type=DataType.ACTION or the matching CLI flag) before calling generate_action","Use the plain generate() API if you actually want image/video output","Re-create the DiffusionGenerator with server_args matching the action model"],"exampleFix":"# before\ngenerator.generate_action(prompt=\"...\")  # server configured for IMAGE\n# after\ngenerator.generate_action(prompt=\"...\", data_type=DataType.ACTION)","handlingStrategy":"type-guard","validationCode":"from sglang.srt.samplers.sampling_params import SamplingParams  # data_type lives on SamplingParams/server_args\ndata_type = getattr(server_args, \"data_type\", None)\nif data_type is not None:\n    assert str(data_type).endswith(\"ACTION\"), f\"need ACTION pipeline, got {data_type}\"","typeGuard":"def supports_action_generation(server_args) -> bool:\n    return str(getattr(server_args, \"data_type\", \"\")).upper().endswith(\"ACTION\")","tryCatchPattern":null,"preventionTips":["Construct one DiffusionGenerator per pipeline type","Assert data_type before calling generate_action"],"tags":["input-validation","action-pipeline","data-type","diffusion"],"backgroundTag":"wrong-pipeline-data-type","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}