Skip to content

IO 错误: 当文件已存在时,无法创建该文件 (os error 183) - cc-switch

Quick fix

A Junction/hard link configuration directory causes the error. Use a regular directory temporarily and wait for a cc-switch fix.

Error output
IO 错误: C:\Users\xxx\.claude: 当文件已存在时,无法创建该文件。 (os error 183)
English translation

IO error: C:\Users\xxx\.claude: Cannot create a file when that file already exists. (os error 183)

When a tool configuration directory (C:\Users\<user>\.claude、.codex, or %LOCALAPPDATA%\Claude-3p for Claude Desktop 3p mode) is a Windows directory Junction/hard link—commonly because data was moved to another drive to save C: space, for example with mklink /J to D: or E:—cc-switch 3.19.1 calls std::fs::create_dir_all before switching providers. This API incorrectly returns os error 183 for an existing Junction/reparse point, so switching stops before the configuration is written.

The issue appears consistently across tools: Claude Code (.claude as a hard link, #5993), Codex (.codex as a junction, #6030), and Claude Desktop 3p (Claude-3p as a junction, #6107). #6030 proposes checking whether the resolved path is already a directory before calling create_dir_all; the issues contain no released fixed version. #6107 also notes that the configuration may still be written after the error, making the dialog somewhat misleading.

  1. Check whether the error path (such as C:\Users\<user>\.claude、.codex or %LOCALAPPDATA%\Claude-3p) is a Junction or hard link. This issue occurs only with that layout.

  2. Temporary workaround: remove the Junction/hard link, restore the configuration directory as a regular local directory, then switch providers again in cc-switch.

  3. If you must keep the Junction, such as to save C: space, temporarily edit the configuration files directly in the linked real directory (such as Codex auth.json / config.toml) to bypass cc-switch writes.

  4. Track the upstream fix: #6030 proposes checking whether the resolved path is an existing directory before create_dir_all. Upgrade when cc-switch releases a version containing the fix.

Toolcc-switch(影响其管理的 Claude Code / Codex / Claude Desktop 3p 配置切换)
Version3.19.1(受影响版本;修复版本未知)
PlatformsWindows
Was the configuration actually written after the error?
Possibly. #6107 reports that the configuration can still be written after the error. The dialog can be misleading; check the actual configuration file before retrying.
Why can I normally read and write this directory, but cc-switch errors only when switching?
Normal file reads and writes can pass through a Junction, but cc-switch calls create_dir_all before writing. It misidentifies an existing Junction/reparse point as a file that already exists, so only switching triggers os error 183.
I moved the directory to another drive to save C: space. Must I remove the Junction?
The issues contain no released fixed version. Removing the link and restoring a regular directory is the most reliable temporary solution; you can also edit configuration files in the real directory manually or wait for an upstream fix following #6030.

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.