duplicate entry with key "mcp_servers" Hermes configuration error
Quick fix
Upgrade to cc-switch v3.16.3 or later, then switch providers to automatically clean up historical duplicate keys.
Symptom
Section titled “Symptom”配置错误: Failed to parse Hermes config as YAML: duplicate entry with key "mcp_servers"Configuration error: Failed to parse Hermes config as YAML: duplicate entry with key "mcp_servers"
On Windows, CRLF line endings may prevent CC Switch from recognizing existing top-level sections in the Hermes YAML file. When switching providers, it may append a new section instead of replacing the existing one, accumulating duplicate `mcp_servers`, `model`, or `custom_providers` keys and causing YAML parsing to fail. The maintainer confirmed that these issues were fixed in v3.16.3: duplicate sections are cleaned up when writing, and the last copy is retained and repaired when reading. A separate macOS report involved a duplicate `base_url` within a `custom_providers` entry. The maintainer could not confirm its cause and recommended upgrading and checking again; this does not establish that it shares the same cause as duplicate top-level keys.
Upgrade to cc-switch v3.16.3 or later, then switch providers again; the maintainer says this version repairs historical duplicate sections when reading and on subsequent writes.
If the issue persists, provide the relevant sections from the Hermes `config.yaml` (redact secrets first) and the CC Switch version for further investigation.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 6 real issues
- #2529Bug: Hermes config YAML duplicate entry with key custom_providers
- #2973Bug: hermesConfigDir causes duplicate YAML keys (custom_providers / model) on Windows
- #3762配置错误: Failed to parse Hermes config as YAML: duplicate entry with key "mcp_servers"
- #3851"Apply <agent> config" 写入策略会产生 YAML duplicate 键
- #3929切换模型的时候报错这个是什么原因?Failed to parse Hermes config as YAML: duplicate entry with key "mcp_servers"
- #4321mac 添加供应商失败
- If the duplicate key error persists after upgrading, what information should I provide?
- Share the relevant sections from `config.yaml` with secrets redacted, and provide the CC Switch version.
Related problems
Section titled “Related problems”This is an unofficial community wiki with no affiliation to the cc-switch authors or the project itself. Its content is compiled from the project's public GitHub issues. This site distributes no software.