Skip to content

Failed to parse Hermes config: duplicate entry - Hermes

Quick fix

Upgrade cc-switch to v3.16.3+ to fix the CRLF-driven config append bug, or delete the duplicate keys in config.yaml by hand.

Error output
配置错误: Failed to parse Hermes config as YAML: duplicate entry with key "mcp_servers"
English translation

Config error: Failed to parse Hermes config as YAML: duplicate entry with key "mcp_servers"

On Windows, the `config.yaml` Hermes generates uses CRLF (`\r\n`) line endings by default. The cc-switch Rust code splits lines on `\n`, and the `\r` left at the end of each line breaks the top-level key detection function.

So when modifying the config, cc-switch cannot find the existing `custom_providers`, `model`, or `mcp_servers` blocks and degrades into appending new config at the end of the file, producing duplicate top-level YAML keys and this parse error. In some cases a duplicated field inside a provider (`base_url`, for instance) causes a similar nested duplicate key error.

  1. Upgrade cc-switch to v3.16.3 or newer. The new version fixes the CRLF detection and tolerates and cleans up historical duplicate keys on read, with no manual file editing needed.

  2. If you need it fixed now and cannot upgrade, open the config file by hand and delete the duplicated `custom_providers`, `model`, or `mcp_servers` blocks — usually keeping the last copy is enough.

    ~/.hermes/config.yaml (Windows 下为 %LOCALAPPDATA%\hermes\config.yaml)
    custom_providers:
    - name: 'old_duplicate'
    base_url: '...'
  3. If Hermes is not installed locally, deleting the `~/.hermes` directory removes the error entirely.

ToolHermes
Version3.13.0 - 3.16.2
PlatformsWindowsmacOSLinux
I deleted the duplicate keys by hand — why does it error again on the next provider switch?
Because the CRLF parsing defect in the older cc-switch is still there, and every write appends the duplicate block again. Only upgrading to v3.16.3+ fixes it properly.
I do not have Hermes installed at all — why do I get this error?
cc-switch tries to manage the Hermes config by default and creates `~/.hermes` automatically. If you do not want that, delete the directory, or disable Hermes from `visibleApps` in `settings.json`.

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.