[BUG] `/export` does not resolve absolute paths or expand tilde in filename argument
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
The /export command treats absolute paths and ~ as literal strings, prepending the current working directory instead of resolving them. This makes it impossible to export to a specific directory using an absolute path.
What Should Happen?
- Paths starting with / should be used as absolute paths.
- ~ should expand to the user's home directory.
Error Messages/Logs
> /export /Users/rps/Desktop/test
Failed to export conversation: ENOENT: no such file or directory, open '/Users/rps/Desktop/old-github/claude-code/Users/rps/Desktop/test.txt'
> /export ~/Desktop/test
Failed to export conversation: ENOENT: no such file or directory, open '/Users/rps/Desktop/old-github/claude-code/~/Desktop/test.txt'
Steps to Reproduce
- Open Claude Code in any project directory
- Run
/export /Users/<you>/Desktop/test - Observe the error shows cwd prepended to the absolute path
- Run
/export ~/Desktop/test - Observe ~ is treated as a literal character in the path
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.92 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
The /export command appears to support relative paths with extensions (e.g., /export ../../test.txt correctly resolves the path), but this is undocumented. /help export provides no information about supported arguments, path syntax, or expected behavior.
The presence or absence of a file extension in the first argument fundamentally changes how the command parses input:
- With extension: only first arg used as filename, relative paths resolve, destination arg silently ignored
- Without extension: all args concatenated as filename, relative paths mangled
This suggests the path resolution logic exists but is gated behind extension detection, and the no-extension code path has a different (broken) implementation.
Tested on macOS with both Opus 4.5 and Opus 4.6 — identical behavior.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗