{"record":{"id":"b87c4bc3b42e7f0c","repo":"sgl-project/sglang","slug":"error-unrecognized-arguments-join-remaining","errorCode":null,"errorMessage":"error: unrecognized arguments: {' '.join(remaining)}","messagePattern":"error: unrecognized arguments: (.+?)","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"python/sglang/multimodal_gen/runtime/server_args/server_args.py","lineNumber":3033,"sourceCode":"        if unknown_args is None:\n            unknown_args = []\n\n        dynamic_quantizations, remaining = cls._extract_component_quantizations(\n            unknown_args\n        )\n        dynamic_ignored_layers, remaining = (\n            cls._extract_component_quantization_ignored_layers(remaining)\n        )\n        # Extract the more specific weights suffix before the generic path alias.\n        dynamic_weights_paths, remaining = cls._extract_component_weights_paths(\n            remaining\n        )\n        dynamic_paths, remaining = cls._extract_component_paths(remaining)\n        dynamic_attention_backends, remaining = (\n            cls._extract_component_attention_backends(remaining)\n        )\n        if remaining:\n            raise SystemExit(f\"error: unrecognized arguments: {' '.join(remaining)}\")\n\n        provided_args = cls.get_provided_args(args, unknown_args)\n        explicit_arg_names = set(provided_args)\n\n        # Handle config file\n        config_file = provided_args.get(\"config\")\n        if config_file:\n            config_args = cls.load_config_file(config_file)\n            explicit_arg_names.update(config_args)\n            provided_args = {**config_args, **provided_args}\n\n        if default_args:\n            for key, value in default_args.items():\n                provided_args.setdefault(key, value)\n\n        if dynamic_paths:\n            existing = dict(provided_args.get(\"component_paths\") or {})\n            existing.update(dynamic_paths)","sourceCodeStart":3015,"sourceCodeEnd":3051,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/multimodal_gen/runtime/server_args/server_args.py#L3015-L3051","documentation":"SystemExit raised by ServerArgs.from_cli_args after CLI parsing and component-path/attention-backend extraction left unrecognized tokens in `remaining`. It is argparse-style strict validation: any argument that is not a known ServerArgs field (or one of the dynamic component extractors) aborts startup.","triggerScenarios":"Passing a misspelled or removed flag (e.g. --tp-size vs --tp_size, or a flag retired in this version), passing a flag value in the wrong position so it is not consumed, or passing component args not handled by _extract_component_paths/_extract_component_attention_backends.","commonSituations":"Upgrading SGLang/multimodal_gen where an argument was renamed or deleted; copy-pasting a launch command from docs for a different version; typos in shell scripts; quoting bugs that split one arg into two tokens.","solutions":["Re-run with --help and compare the exact spelling of the offending argument named in the message.","Check the release notes / _reject_retired_args list for renamed arguments and update the command.","Fix shell quoting so each flag and its value form the expected tokens.","Remove the unsupported argument entirely if the feature no longer exists."],"exampleFix":"# before\n--model-path ... --tensore-paralle-size 2   # typo\n# after\n--model-path ... --tensor-parallel-size 2","handlingStrategy":"validation","validationCode":"import inspect, dataclasses\nvalid = {f.name for f in dataclasses.fields(ServerArgs)}\nunknown = [a for a in my_flags if a.lstrip(\"-\").replace(\"-\", \"_\") not in valid]\nassert not unknown, f\"bad flags: {unknown}\"","typeGuard":"def is_valid_flag(flag: str) -> bool:\n    name = flag.lstrip(\"-\").replace(\"-\", \"_\").split(\"=\")[0]\n    return name in {f.name for f in dataclasses.fields(ServerArgs)}","tryCatchPattern":"try:\n    args = ServerArgs.from_cli_args(argv)\nexcept SystemExit as e:\n    log.error(\"CLI rejected: %s\", e); raise","preventionTips":["Build commands programmatically from ServerArgs field names.","Add a smoke-test that parses your standard launch command in CI.","Re-validate scripts after upgrading the library."],"tags":["cli","argparse","argument-validation","startup"],"backgroundTag":"unknown-cli-argument","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}