{"record":{"id":"9b3e4d7784d99775","repo":"sgl-project/sglang","slug":"grpc-port-is-not-supported-with-use-ray-the-r","errorCode":null,"errorMessage":"--grpc-port is not supported with --use-ray: the Ray serve launch path does not start the native gRPC server.","messagePattern":"--grpc-port is not supported with --use-ray: the Ray serve launch path does not start the native gRPC server\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/server_args.py","lineNumber":4532,"sourceCode":"            if cfg.sidecar is None:\n                raise ValueError(\"--sidecar-args requires --sidecar.\")\n            if not isinstance(cfg.sidecar_args, list) or not all(\n                isinstance(arg, str) for arg in cfg.sidecar_args\n            ):\n                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                )","sourceCodeStart":4514,"sourceCodeEnd":4550,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/server_args.py#L4514-L4550","documentation":"Native gRPC (--grpc-port) is only wired into SGLang's standard launch path; the Ray serve launch path does not start the gRPC server, so combining --grpc-port with --use-ray is rejected.","triggerScenarios":"Passing --use-ray together with --grpc-port (or SGLANG_GRPC_PORT) in ServerArgs.","commonSituations":"Copying a single-node gRPC launch command onto a Ray cluster deployment, or a shared config template that sets SGLANG_GRPC_PORT globally.","solutions":["Remove --grpc-port / unset SGLANG_GRPC_PORT when using --use-ray","Expose gRPC via your own Ray serve deployment or use the HTTP entrypoint instead"],"exampleFix":"# before\n--use-ray --grpc-port 50051\n# after\n--use-ray","handlingStrategy":"validation","validationCode":"if args.get(\"use_ray\") and (args.get(\"grpc_port\") or os.environ.get(\"SGLANG_GRPC_PORT\")):\n    raise SystemExit(\"--grpc-port is unsupported with --use-ray; unset it\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep per-launch-path config profiles (ray vs single-node) instead of one shared flag soup","Unset SGLANG_GRPC_PORT in Ray job environments"],"tags":["grpc","ray","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"}