Skip to content

No such file or directory (os error 2) - Codex

Quick fix

Change the model_catalog_json absolute path in config.toml to the relative cc-switch-model-catalog.json, or upgrade cc-switch.

Error output
Error loading configuration: No such file or directory (os error 2)

Running cc-switch on a Windows host and configuring a third-party provider (DeepSeek, for instance) for Codex inside WSL, cc-switch generates a Windows UNC absolute path in config.toml automatically (\\wsl.localhost\Ubuntu\home\user\.codex\cc-switch-model-catalog.json, for example).

Because the WSL Linux system calls cannot resolve that Windows UNC path, Codex cannot find the model catalog file at startup and throws the os error 2.

  1. Upgrade cc-switch to a version containing the #3614 fix, which writes a relative filename automatically.

  2. Or edit the Codex config file inside WSL by hand and change the model_catalog_json value to a relative path.

    ~/.codex/config.toml
    model_catalog_json = '\\wsl.localhost\Ubuntu-24.04\home\xxxxx\.codex\cc-switch-model-catalog.json'
    model_catalog_json = 'cc-switch-model-catalog.json'
ToolCodex
VersionUnknown
PlatformsWindows
Why does cc-switch generate a path starting with \\wsl.localhost?
Because cc-switch runs on the Windows host and by default gets the WSL path from the Windows point of view (UNC format), which the Linux environment inside WSL cannot read directly.
Can Codex find the file once it is a relative path?
Yes. The Codex CLI resolves the model_catalog_json relative path against the directory the config file is in, so cc-switch-model-catalog.json works directly.

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.