{"record":{"id":"e36f4f916a69cf02","repo":"sgl-project/sglang","slug":"sidecar-args-requires-sidecar","errorCode":null,"errorMessage":"--sidecar-args requires --sidecar.","messagePattern":"--sidecar-args requires --sidecar\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/server_args.py","lineNumber":4515,"sourceCode":"\n        if cfg.grpc_port is not None:\n            if not (1 <= cfg.grpc_port <= 65535):\n                raise ValueError(\n                    \"--grpc-port / SGLANG_GRPC_PORT \"\n                    f\"({cfg.grpc_port}) must be between 1 and 65535\"\n                )\n            if cfg.grpc_worker_threads is not None and cfg.grpc_worker_threads < 1:\n                raise ValueError(\n                    \"SGLANG_GRPC_WORKER_THREADS \"\n                    f\"({cfg.grpc_worker_threads}) must be >= 1\"\n                )\n\n        # Native gRPC is incompatible with launch paths it doesn't wire into.\n        # Legacy takes precedence over grpc_port, keeping re-runs idempotent.\n        native_grpc = cfg.grpc_port is not None and not legacy_grpc\n        if cfg.sidecar_args is not None:\n            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 \"","sourceCodeStart":4497,"sourceCodeEnd":4533,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/server_args.py#L4497-L4533","documentation":"SGLang's --sidecar-args option (a JSON array of extra args passed to a gRPC sidecar process) is only meaningful together with --sidecar. Config resolution rejects sidecar args when no sidecar command was given.","triggerScenarios":"Passing --sidecar-args '[\"--verbose\"]' on the command line without also passing --sidecar \"<command>\", then launching the server or resolving ServerArgs.","commonSituations":"Splitting a working launch command into a template and forgetting the --sidecar flag; disabling the sidecar temporarily but leaving its args in the config file.","solutions":["Add a --sidecar value, e.g. --sidecar \"python sidecar.py\" --sidecar-args '[\"--port\",\"9000\"]'","Remove --sidecar-args if no sidecar is intended"],"exampleFix":"# before\n--sidecar-args '[\"--port=9000\"]'\n# after\n--sidecar \"python sidecar.py\" --sidecar-args '[\"--port=9000\"]'","handlingStrategy":"validation","validationCode":"if args.get(\"sidecar_args\") and not args.get(\"sidecar\"):\n    raise SystemExit(\"--sidecar-args requires --sidecar; add it or drop sidecar_args\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep --sidecar and --sidecar-args adjacent in launch templates so they are edited together","Validate paired flags in your deploy script before invoking sglang"],"tags":["grpc","sidecar","config-validation","server-args"],"backgroundTag":"dependent-option-missing","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}