{"record":{"id":"af32d1bb9bf09629","repo":"sgl-project/sglang","slug":"multiple-config-files-specified-only-one-allowed","errorCode":null,"errorMessage":"Multiple config files specified! Only one allowed.","messagePattern":"Multiple config files specified! Only one allowed\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/utils/server_args_config_parser.py","lineNumber":90,"sourceCode":"        config_data = self._parse_yaml_config(config_file_path)\n        config_args = self._convert_config_to_args(config_data)\n\n        # Merge config args into CLI args\n        config_index = cli_args.index(\"--config\")\n\n        # Split arguments around config file\n        before_config = cli_args[:config_index]\n        after_config = cli_args[config_index + 2 :]  # Skip --config and file path\n\n        # Simple merge: config args + CLI args\n        return config_args + before_config + after_config\n\n    def _extract_config_file_path(self, args: List[str]) -> str:\n        \"\"\"Extract the config file path from arguments.\"\"\"\n        config_indices = [i for i, arg in enumerate(args) if arg == \"--config\"]\n\n        if len(config_indices) > 1:\n            raise ValueError(\"Multiple config files specified! Only one allowed.\")\n\n        if not config_indices:\n            return None\n\n        config_index = config_indices[0]\n        if config_index == len(args) - 1:\n            raise ValueError(\"No config file specified after --config flag!\")\n\n        return args[config_index + 1]\n\n    def _parse_yaml_config(self, file_path: str) -> Dict[str, Any]:\n        \"\"\"\n        Parse YAML configuration file and convert to argument list.\n\n        Args:\n            file_path: Path to the YAML configuration file\n\n        Returns:","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/utils/server_args_config_parser.py#L72-L108","documentation":"The --config flag accepts exactly one YAML file per server launch. _extract_config_file_path scans the raw argv for occurrences of the literal '--config' and raises if it finds more than one. This prevents ambiguous merging of multiple config files.","triggerScenarios":"Passing --config more than once on the command line, e.g. `--config a.yaml --config b.yaml`, or a wrapper script that appends --config to an argv that already contains it.","commonSituations":"Shell scripts that conditionally append --config, or copy-pasted launch commands combining a base config with an override config.","solutions":["Merge the two YAML files into one before launching","Move per-launch overrides from a second config into plain CLI flags (CLI args override config values)","Check argv construction in wrapper scripts for duplicated --config"],"exampleFix":"# before\npython -m sglang.launch_server --config base.yaml --config override.yaml\n# after\npython -m sglang.launch_server --config merged.yaml --model-path /new/path","handlingStrategy":"validation","validationCode":"if args.count(\"--config\") > 1:\n    raise SystemExit(\"only one --config allowed; merge YAML files\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Build CLI argv programmatically and assert flags appear once","Use CLI flags instead of a second config for overrides"],"tags":["sglang","cli","config","yaml"],"backgroundTag":"duplicate-cli-flag","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}