{"record":{"id":"985dcbf9de2e261e","repo":"HKUDS/Vibe-Trading","slug":"unsupported-config-file-format-suffix-or-none","errorCode":null,"errorMessage":"Unsupported config file format: {suffix or '<none>'}","messagePattern":"Unsupported config file format: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/src/config/loader.py","lineNumber":255,"sourceCode":"\n    Returns:\n        The decoded config object as a dictionary.\n\n    Raises:\n        ValueError: If the file format is unsupported, YAML support is\n            unavailable, or the decoded payload is not an object.\n    \"\"\"\n    suffix = path.suffix.lower()\n    text = path.read_text(encoding=\"utf-8\")\n\n    if suffix == \".json\":\n        data = json.loads(text)\n    elif suffix in {\".yaml\", \".yml\"}:\n        if yaml is None:\n            raise ValueError(\"YAML config is not available because PyYAML is missing\")\n        data = yaml.safe_load(text) or {}\n    else:\n        raise ValueError(f\"Unsupported config file format: {suffix or '<none>'}\")\n\n    if not isinstance(data, dict):\n        raise ValueError(\"Agent config must decode to a JSON/YAML object\")\n    return data\n\n\ndef _merge_agent_config_dicts(base: dict[str, Any], override: dict[str, Any]) -> dict[str, Any]:\n    \"\"\"Merge top-level agent config payloads with MCP-aware server replacement.\"\"\"\n    non_mcp_override = {key: value for key, value in override.items() if key != \"mcp_servers\"}\n    merged = _merge_dicts(base, non_mcp_override)\n\n    override_servers = override.get(\"mcp_servers\")\n    if not isinstance(override_servers, dict):\n        if \"mcp_servers\" in override:\n            merged[\"mcp_servers\"] = override_servers\n        return merged\n\n    merged_servers = dict(base.get(\"mcp_servers\", {}))","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/config/loader.py#L237-L273","documentation":"Raised by _read_config_file when the config file suffix is neither .json, .yaml, nor .yml. The loader dispatches purely on file extension, so any other suffix (including no suffix) is rejected before parsing.","triggerScenarios":"Passing a config path like config.toml, config.conf, config.ini, or a file with no extension to load_agent_config.","commonSituations":"Renaming configs during migration; symlinks or generated temp files that lose the extension; assuming format detection is content-based.","solutions":["Rename the file to end in .json, .yaml, or .yml.","If the content is JSON in a differently named file, copy it to a .json path.","Check for stray characters/whitespace in the filename that corrupt the suffix."],"exampleFix":"# before\nload_agent_config(Path('config.toml'))\n\n# after\nload_agent_config(Path('config.json'))","handlingStrategy":"validation","validationCode":"from pathlib import Path\n\nSUPPORTED = {'.json', '.yaml', '.yml'}\n\ndef config_path_ok(path: str) -> bool:\n    return Path(path).suffix.lower() in SUPPORTED","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize config filenames on .json/.yaml in tooling and templates","Fail fast in CLI arg parsing on unsupported extensions"],"tags":["config","file-format","validation"],"backgroundTag":"unsupported-file-format","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}