claude-code - 💡(How to fix) Fix [Bug] /export command broken on Windows: path handling and mkdir recursion failures [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#52161Fetched 2026-04-23 07:35:01
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
labeled ×4

Error Message

[{"error":"Error: ENOENT: no such file or directory, unlink 'C:\Users\mecav\AppData\Local\Temp\claude\D--MEC-OneDrive-Documents-AI-Claude-AI-Claude-Code-Projects\61a57656-002a-4b67-813a-99760ff99f5e\tasks\a5d32470d4adba3f2.output'\n at async <anonymous> (B:/~BUN/root/src/entrypoints/cli.js:7985:299)","timestamp":"2026-04-22T22:35:58.190Z"}]

Fix Action

Fix / Workaround

Bug Description Bug: /export broken on Windows — path argument mishandled, default mode fails on CWD

Version:

Diagnostics

├ Currently running: native (2.1.117)

├ Commit: 5e9d59ce46d5

├ Platform: win32-x64

├ Path: C:\Users\mecav.local\bin\claude.exe

├ Config install method: native

└ Search: OK (bundled)

Updates

├ Auto-updates: enabled

├ Auto-update channel: latest

├ Stable version: 2.1.104

└ Latest version: 2.1.117(run /doctor and paste your version here)

OS: Windows 11 Pro (10.0.26200)

Shell: bash on Windows

Started: ~1 week ago. Previously worked fine.

Symptom 1 — /export with no argument

/export

→ Failed to export conversation: EEXIST: file already exists,

mkdir 'D:\MEC\OneDrive\Documents\AI\Claude AI\Claude Code Projects'

The path in the error is my current working directory. /export is trying to mkdir the CWD itself (which of course exists). Looks like a missing {

recursive: true } on the fs.mkdir call, or the output path is being resolved to the CWD instead of a subfolder.

Symptom 2 — /export with a filename argument

/export travel-time-agent-debug-2

→ (same EEXIST error on CWD)

Symptom 3 — /export with an absolute path argument

/export "D:\MEC\OneDrive\Documents\AI\Claude AI\Claude Code Projects\Google Travel Time Agent\travel-time-agent-debug-2"

→ Failed to export conversation: ENOENT: no such file or directory,

mkdir 'D:\MEC\OneDrive\Documents\AI\Claude AI\Claude Code Projects\"D:\MEC\OneDrive\Documents\AI\Claude AI\Claude Code Projects\Google Travel Time

Agent'

Two bugs visible in this error:

  1. Absolute paths are treated as relative. The argument is being path.join'd onto the CWD instead of detected as absolute. You can see the CWD prefix

followed by the full absolute path I provided.

  1. Surrounding double-quotes are not stripped from the argument. Note the literal "D:\ in the mkdir target — the opening quote character is being

included in the path.

Both also reproduce with a non-OneDrive absolute path (C:\Users\mecav\Documents...) — same concatenation behavior.

Reproduction

  1. Open any directory on Windows in Claude Code (OneDrive or non-OneDrive, path with or without spaces — all affected).

  2. Try /export, /export name, and /export "C:\any\absolute\path\name".

  3. All three fail with EEXIST or ENOENT as above.

Impact

/export is unusable on Windows. No workaround found (tried filename-only, absolute paths inside OneDrive, absolute paths outside OneDrive, and no-arg).

Suggested fix areas

  • Use fs.mkdir(dir, { recursive: true }) or check fs.existsSync before creating.

  • When argument is provided, detect absolute paths (path.isAbsolute) and skip the CWD join.

  • Strip surrounding quote characters from the argument before path resolution.


Code Example

[{"error":"Error: ENOENT: no such file or directory, unlink 'C:\\Users\\mecav\\AppData\\Local\\Temp\\claude\\D--MEC-OneDrive-Documents-AI-Claude-AI-Claude-Code-Projects\\61a57656-002a-4b67-813a-99760ff99f5e\\tasks\\a5d32470d4adba3f2.output'\n    at async <anonymous> (B:/~BUN/root/src/entrypoints/cli.js:7985:299)","timestamp":"2026-04-22T22:35:58.190Z"}]
RAW_BUFFERClick to expand / collapse

Bug Description Bug: /export broken on Windows — path argument mishandled, default mode fails on CWD

Version:

Diagnostics

├ Currently running: native (2.1.117)

├ Commit: 5e9d59ce46d5

├ Platform: win32-x64

├ Path: C:\Users\mecav.local\bin\claude.exe

├ Config install method: native

└ Search: OK (bundled)

Updates

├ Auto-updates: enabled

├ Auto-update channel: latest

├ Stable version: 2.1.104

└ Latest version: 2.1.117(run /doctor and paste your version here)

OS: Windows 11 Pro (10.0.26200)

Shell: bash on Windows

Started: ~1 week ago. Previously worked fine.

Symptom 1 — /export with no argument

/export

→ Failed to export conversation: EEXIST: file already exists,

mkdir 'D:\MEC\OneDrive\Documents\AI\Claude AI\Claude Code Projects'

The path in the error is my current working directory. /export is trying to mkdir the CWD itself (which of course exists). Looks like a missing {

recursive: true } on the fs.mkdir call, or the output path is being resolved to the CWD instead of a subfolder.

Symptom 2 — /export with a filename argument

/export travel-time-agent-debug-2

→ (same EEXIST error on CWD)

Symptom 3 — /export with an absolute path argument

/export "D:\MEC\OneDrive\Documents\AI\Claude AI\Claude Code Projects\Google Travel Time Agent\travel-time-agent-debug-2"

→ Failed to export conversation: ENOENT: no such file or directory,

mkdir 'D:\MEC\OneDrive\Documents\AI\Claude AI\Claude Code Projects\"D:\MEC\OneDrive\Documents\AI\Claude AI\Claude Code Projects\Google Travel Time

Agent'

Two bugs visible in this error:

  1. Absolute paths are treated as relative. The argument is being path.join'd onto the CWD instead of detected as absolute. You can see the CWD prefix

followed by the full absolute path I provided.

  1. Surrounding double-quotes are not stripped from the argument. Note the literal "D:\ in the mkdir target — the opening quote character is being

included in the path.

Both also reproduce with a non-OneDrive absolute path (C:\Users\mecav\Documents...) — same concatenation behavior.

Reproduction

  1. Open any directory on Windows in Claude Code (OneDrive or non-OneDrive, path with or without spaces — all affected).

  2. Try /export, /export name, and /export "C:\any\absolute\path\name".

  3. All three fail with EEXIST or ENOENT as above.

Impact

/export is unusable on Windows. No workaround found (tried filename-only, absolute paths inside OneDrive, absolute paths outside OneDrive, and no-arg).

Suggested fix areas

  • Use fs.mkdir(dir, { recursive: true }) or check fs.existsSync before creating.

  • When argument is provided, detect absolute paths (path.isAbsolute) and skip the CWD join.

  • Strip surrounding quote characters from the argument before path resolution.


Environment Info

  • Platform: win32
  • Terminal: windows-terminal
  • Version: 2.1.117
  • Feedback ID: 3d9f61d2-f825-4abf-9aca-74a8840ffdc4

Errors

[{"error":"Error: ENOENT: no such file or directory, unlink 'C:\\Users\\mecav\\AppData\\Local\\Temp\\claude\\D--MEC-OneDrive-Documents-AI-Claude-AI-Claude-Code-Projects\\61a57656-002a-4b67-813a-99760ff99f5e\\tasks\\a5d32470d4adba3f2.output'\n    at async <anonymous> (B:/~BUN/root/src/entrypoints/cli.js:7985:299)","timestamp":"2026-04-22T22:35:58.190Z"}]

extent analysis

TL;DR

The /export command on Windows is broken due to incorrect path handling, and a potential fix involves modifying the fs.mkdir call to use recursive mode and properly handling absolute paths.

Guidance

  • The issue seems to stem from the fs.mkdir call not using recursive mode, which causes an error when trying to create a directory that already exists. Using fs.mkdir(dir, { recursive: true }) might resolve this.
  • When an argument is provided to the /export command, the code should detect if it's an absolute path using path.isAbsolute and skip joining it with the current working directory.
  • The code should also strip surrounding quote characters from the argument before resolving the path to avoid incorrect directory creation.
  • To verify the fix, try running the /export command with and without arguments, and with absolute and relative paths, to ensure it creates the correct directories without errors.

Example

const fs = require('fs');
const path = require('path');

// ...

fs.mkdir(dir, { recursive: true }, (err) => {
  if (err) {
    // handle error
  }
});

// ...

if (path.isAbsolute(argument)) {
  // use argument as is
} else {
  // join argument with current working directory
}

Notes

The provided error messages and reproduction steps suggest that the issue is specific to the Windows platform and the win32-x64 architecture. The suggested fix areas provided in the issue description are a good starting point for resolving the problem.

Recommendation

Apply a workaround by modifying the fs.mkdir call to use recursive mode and properly handling absolute paths, as this seems to be the root cause of the issue. This should resolve the errors and make the /export command usable on Windows.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [Bug] /export command broken on Windows: path handling and mkdir recursion failures [1 participants]