aws / aws/amazon-q-developer-cli
Q CLI crashes when current working directory is deleted
- Dominant language
- Rust
- Stars
- 2k
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
### Checks
- [x] I have searched [github.com/aws/amazon-q-developer-cli/issues](https://github.com/aws/amazon-q-developer-cli/issues?q=) and there are no duplicates of my issue
- [x] I have run `q doctor` in the affected terminal session
- [x] I have run `q restart` and replicated the issue again
### Operating system
macOS 26.0.1 (25A362)
### Expected behaviour
When Q CLI deletes its current working directory, it should handle the situation gracefully with one of these approaches:
1. Warn user before deleting the current working directory
2. Prevent deletion of the directory Q is running in
3. Auto-change to parent/home directory after deletion
4. Catch the error and prompt user to change directory instead of crashing
### Actual behaviour
CLI crashes with "No such file or directory (os error 2)" at crates/chat-cli/src/cli/chat/mod.rs:1026
Error output:
Amazon Q is having trouble responding right now:
0: No such file or directory (os error 2)
1: No such file or directory (os error 2)
Location:
crates/chat-cli/src/cli/chat/mod.rs:1026
CLI becomes unresponsive and requires exit. Shell must be reset with cd ~
### Steps to reproduce
1. Start Q CLI in a test directory: `mkdir test-dir && cd test-dir && q`
2. Ask Q to delete the current directory: `rm -rf /full/path/to/test-dir`
3. Send any message after deletion completes
4. CLI crashes with:
Amazon Q is having trouble responding right now:
0: No such file or directory (os error 2)
1: No such file or directory (os error 2)
Location:
crates/chat-cli/src/cli/chat/mod.rs:1026
### Environment
```yaml
[q-details]
version = "1.18.1"
hash = "5610605baef17b76ef41448f2e943f021c2b2273"
date = "2025-10-13T22:31:07.064465Z (11d ago)"
[system-info]
os = "macOS 26.0.1 (25A362)"
chip = "Apple M1 Pro"
total-cores = 8
memory = "16.00 GB"
[environment]
cwd = "/Users/USER"
cli-path = "/Users/USER"
install-method = "brew"
[env-vars]
PATH = "/Users/USER/.local/bin:/Users/USER/.toolbox/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/Apple/usr/bin:/Applications/Ghostty.app/Contents/MacOS:/Users/USER/.local/bin"
QTERM_SESSION_ID = "5188b7e3f3cd4a16b7e4c2dd0e7c7a70"
Q_SET_PARENT_CHECK = "1"
Q_TERM = "1.18.1"
SHELL = "/bin/zsh"
TERM = "xterm-ghostty"
__CFBundleIdentifier = "com.mitchellh.ghostty"
[chat-settings]
[chat-trusted_tools]
[chat-failed_request_ids]
none
[chat-context]
current_profile=q_cli_default
profile_context=
AmazonQ.md
AGENTS.md
README.md
.amazonq/rules/**/*.md
files=none
```
Contributor guide
Assessment
This issue has not been assessed yet.