{"record":{"id":"fd57b628cb1a9881","repo":"sgl-project/sglang","slug":"config-file-must-be-yaml-format-got-path-suffix","errorCode":null,"errorMessage":"Config file must be YAML format, got: {path.suffix}","messagePattern":"Config file must be YAML format, got: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/utils/server_args_config_parser.py","lineNumber":136,"sourceCode":"                config_data = yaml.safe_load(file)\n        except Exception as e:\n            logger.error(f\"Failed to read config file {file_path}: {e}\")\n            raise\n\n        # Handle empty files or None content\n        if config_data is None:\n            config_data = {}\n\n        if not isinstance(config_data, dict):\n            raise ValueError(\"Config file must contain a dictionary at root level\")\n\n        return config_data\n\n    def _validate_yaml_file(self, file_path: str) -> None:\n        \"\"\"Validate that the file is a YAML file.\"\"\"\n        path = Path(file_path)\n        if path.suffix.lower() not in [\".yaml\", \".yml\"]:\n            raise ValueError(f\"Config file must be YAML format, got: {path.suffix}\")\n\n        if not path.exists():\n            raise ValueError(f\"Config file not found: {file_path}\")\n\n    def _convert_config_to_args(self, config: Dict[str, Any]) -> List[str]:\n        \"\"\"Convert configuration dictionary to argument list.\"\"\"\n        args = []\n\n        for key, value in config.items():\n            key_norm = key.replace(\"-\", \"_\")\n            if key_norm in self.unsupported_actions:\n                action = self.unsupported_actions[key_norm]\n                msg = f\"Unsupported config option '{key_norm}' with action '{action.__class__.__name__}'\"\n                raise ValueError(msg)\n            if isinstance(value, bool):\n                self._add_boolean_arg(args, key, value)\n            elif isinstance(value, list):\n                self._add_list_arg(args, key, value)","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/utils/server_args_config_parser.py#L118-L154","documentation":"The config parser only accepts files with a .yaml or .yml suffix (case-insensitive) and rejects anything else before touching the file. This is a cheap guard so mispointed files fail loudly.","triggerScenarios":"Passing --config server.json, --config config.txt, or any path whose Path.suffix is not .yaml/.yml.","commonSituations":"Renaming a JSON or template file to use with --config, or passing the model path instead of the config path by mistake.","solutions":["Rename or convert the file to .yaml/.yml","If the file is JSON, convert it to YAML key:value mapping first","Double-check the argument order — --config expects the config path, not the model path"],"exampleFix":"# before\npython -m sglang.launch_server --config settings.json\n# after\npython -m sglang.launch_server --config settings.yaml","handlingStrategy":"validation","validationCode":"from pathlib import Path\nassert Path(cfg).suffix.lower() in {\".yaml\", \".yml\"}, \"config must be .yaml/.yml\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize config file naming (.yaml)","Separate model-path and config-path variables to avoid mixups"],"tags":["sglang","yaml","file-extension","config"],"backgroundTag":"unsupported-file-format","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}