{"record":{"id":"8fbea4cd49f3ddb1","repo":"sgl-project/sglang","slug":"grpc-port-is-not-supported-with-encoder-only","errorCode":null,"errorMessage":"--grpc-port is not supported with --encoder-only: encoder disaggregation uses its own server.","messagePattern":"--grpc-port is not supported with --encoder-only: encoder disaggregation uses its own server\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/server_args.py","lineNumber":4537,"sourceCode":"                raise ValueError(\"--sidecar-args must be a JSON array of strings.\")\n        if cfg.sidecar is not None:\n            if not cfg.sidecar.strip():\n                raise ValueError(\"--sidecar must not be empty.\")\n            if legacy_grpc:\n                raise ValueError(\n                    \"--sidecar requires SGLang's native gRPC server; \"\n                    \"it cannot be combined with --smg-grpc-mode/--grpc-mode.\"\n                )\n            if cfg.grpc_port is None:\n                raise ValueError(\"--sidecar requires --grpc-port or SGLANG_GRPC_PORT.\")\n        if native_grpc:\n            if cfg.use_ray:\n                raise ValueError(\n                    \"--grpc-port is not supported with --use-ray: the Ray \"\n                    \"serve launch path does not start the native gRPC server.\"\n                )\n            if cfg.encoder_only:\n                raise ValueError(\n                    \"--grpc-port is not supported with --encoder-only: \"\n                    \"encoder disaggregation uses its own server.\"\n                )\n            if cfg.tokenizer_worker_num > 1:\n                raise ValueError(\n                    \"Native gRPC does not yet support --tokenizer-worker-num > 1. \"\n                    \"Unset --grpc-port or set --tokenizer-worker-num 1.\"\n                )\n            if cfg.api_key or cfg.admin_api_key:\n                raise ValueError(\n                    \"--grpc-port is incompatible with --api-key/--admin-api-key: \"\n                    \"the native gRPC listener bypasses HTTP auth middleware.\"\n                )\n\n    def _handle_prefill_delayer_env_compat(self):\n        if envs.SGLANG_SCHEDULER_DECREASE_PREFILL_IDLE.get():\n            self._declare(\n                \"_handle_prefill_delayer_env_compat\",","sourceCodeStart":4519,"sourceCodeEnd":4555,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/server_args.py#L4519-L4555","documentation":"Encoder-only deployments use SGLang's encoder disaggregation server, which has its own serving stack; the native gRPC listener is not integrated, so --grpc-port plus --encoder-only is rejected during ServerArgs resolution.","triggerScenarios":"Passing --encoder-only together with --grpc-port or SGLANG_GRPC_PORT.","commonSituations":"Reusing a decoding-server gRPC launch command for an encoder deployment; global SGLANG_GRPC_PORT leaking into encoder worker pods.","solutions":["Remove --grpc-port / unset SGLANG_GRPC_PORT for encoder-only deployments","Use the encoder disaggregation server's own interface"],"exampleFix":"# before\n--encoder-only --grpc-port 50051\n# after\n--encoder-only","handlingStrategy":"validation","validationCode":"if args.get(\"encoder_only\") and (args.get(\"grpc_port\") or os.environ.get(\"SGLANG_GRPC_PORT\")):\n    raise SystemExit(\"--grpc-port is unsupported with --encoder-only; unset it\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Maintain separate flag sets for encoder vs decoder deployments","Do not set SGLANG_GRPC_PORT cluster-wide in k8s namespaces shared by encoder pods"],"tags":["grpc","encoder-only","flag-conflict","config-validation"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}