--channels plugin fails on Windows: EEXIST: file already exists, mkdir '~/.claude'
Description
Running Claude Code with --channels plugin:telegram@claude-plugins-official on Windows 11 causes every inbound message to fail with:
API Error: EEXIST: file already exists, mkdir 'C:\Users\<user>\.claude'
Environment
- OS: Windows 11 Pro 10.0.26200
- Claude Code: v2.1.81
- Shell: PowerShell
- Bun: installed (required by plugin)
Steps to reproduce
- Install telegram plugin:
/plugin install telegram@claude-plugins-official - Configure token:
/telegram:configure <token> - Restart with channels:
claude --channels plugin:telegram@claude-plugins-official - Pair account via
/telegram:access pair <code> - Send any message from Telegram
Expected
Claude receives and replies to the message.
Actual
Every message fails with:
API Error: EEXIST: file already exists, mkdir 'C:\Users\<user>\.claude'
Root cause hypothesis
Bun's mkdirSync on Windows throws EEXIST when any path component already exists, even with { recursive: true }. The plugin's server.ts calls mkdirSync(STATE_DIR, { recursive: true }) where STATE_DIR is ~/.claude/channels/telegram. Since ~/.claude already exists, Bun throws EEXIST referencing that component.
Patching server.ts locally to catch EEXIST did not resolve the error, suggesting the mkdir call may be occurring inside Claude Code's own channel infrastructure rather than (or in addition to) the plugin server.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗