os error 183, cannot create a file when that file already exists - Claude Code
Quick fix
On Windows, cc-switch reports os error 183 when the config directory is a Junction. Remove the directory link for now, or wait for an official fix.
Symptom
Section titled “Symptom”IO 错误: C:\Users\xxx\.claude: 当文件已存在时,无法创建该文件。 (os error 183)IO error: C:\Users\xxx\.claude: cannot create a file when that file already exists. (os error 183)
On Windows, if you set the Claude Code or Codex config directory (.claude or .codex) as a directory junction with mklink /J to save space on the C drive, cc-switch calls std::fs::create_dir_all when switching config. Faced with an existing directory junction, that function wrongly returns error 183 and the switch fails.
Remove the Junction link on the config directory for now, restoring it to an ordinary directory, then switch config with cc-switch.
Wait for a fixed cc-switch release. Officially, it needs to check whether the resolved path is already a directory before calling create_dir_all, so a Junction does not produce 183.
Affected Versions
Section titled “Affected Versions”Source Issues
Section titled “Source Issues”This page is distilled from 3 real issues
- Did the config actually get written after the error?
- Per user reports, the config sometimes is written despite the error, so the dialog is misleading. Removing the Junction is still advisable for stability.
- Why do ordinary file reads and writes work while only cc-switch errors?
- Because cc-switch uses Rust's std::fs::create_dir_all underneath, which returns 183 on an existing Junction on Windows, while ordinary read and write operations pass through a Junction fine.
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.