aws / aws/amazon-q-developer-cli

Q CLI deleted entire project directories with thousands of files

Open
#3,491 0 comments 0 reactions 0 assignees View on GitHub
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.1.0 (25B78)

### Expected behaviour

Q CLI should only read files for analysis and never delete user data

Hey Guys... wanted to share a Q Incident with you.
I've been using Q for a couple of weeks now. Love it. Generally takes good prompts and provides good answers
However... .while resuming work on an issue from last week... Q crashed today... HARD
All Q tabs were down and could not recover
I decided to reboot.
When i went to resume my conversation... Q could not load the session i had previously saved/loaded several times before
Additionally.... it had deleted the entire contents of my source code folder... except for the root folder i was working in
It also deleted a nearby project folder.
So...
/User/Me/Projects/Project 1 -- totally gone
/User/Me/Projects/Project 2 -- this is where i was running Q. Entire contents gone... but actual folder still exists
The only thing remaining in the Project 2 folder was a .idea folder (IntelliJ was up and perhaps had this file locked?)
Thankfully, I had pushed source updates recently and had no code changes in flight.
I don't know if there's a core file or log file or anything to recover and send to Amazon, but this was a catastrophic failure beyond anything i've encountered before

### Actual behaviour

Q CLI appears to have deleted two entire project directories (/Users/firstname.lastname/PFlex/CArchitecture-Axxxx-UI and potentially others) containing thousands of source code files during a crash

```
[chat-transcript]
> The crashes were likely caused by Q trying to parse files in directories tha

I determined this from the error messages in your Q log file. When I checked the last 20 lines of `~/.aws/amazonq/lspLog.log`, I found these specific errors:

\```
2025-11-24T19:57:53.098Z: 20800 [ERROR] Failed to parse workspace files Error: ENOENT: no such file or directory, scandir '/Users/firstname.lastname/PFlex/CArchitecture-Axxxx-UI
2025-11-24T19:57:53.680Z: 20800 [ERROR] Failed to parse workspace files Error: ENOENT: no such file or directory, scandir '/Users/firstname.lastname/PFlex/CArchitecture-Axxxx-UI
2025-11-24T19:57:54.618Z: 6677 [ERROR] Failed to parse workspace files Error: ENOENT: no such file or directory, scandir '/Users/firstname.lastname/PFlex/CManagement-PAMS-MS'
\```

`ENOENT` means "Error NO ENTry" - the file or directory doesn't exist. Q was repeatedly trying to scan directories that had been deleted or moved, which can cause instability and crashes when the file parsing system encounters these missing paths.

NOTE: I would say that Q was repeatedly trying to scan directories that IT HAD DELETED. These were source code folder for projects i am actively working on. Contents are stored in github... these were deleted by Q when it failed

The pattern of repeated failed attempts to access non-existent directories is a common cause of application hangs and crashes in file-watching systems.
[Tool uses: none]

> Those folders had source code for 2 different projects... that disappeared when Q crashed. They had many thousands of files in each..

That's concerning - Q shouldn't be deleting user files. Let me help you check if the files might be recoverable.

First, let's see if the directories still exist but are empty:
[Tool uses: fs_read]

I only see one project directory. Let's check if there are any recent file deletions in the system logs:
[Tool uses: execute_bash]

Let's check if the files might be in Trash:
[Tool uses: execute_bash]

Let's also check if you have Time Machine backups or any git repositories that might help recover the code:
[Tool uses: execute_bash]

This is a serious issue. Q CLI should never delete user files. To help recover your projects:

1. **Check if you have git repositories elsewhere** - search your system for the project names
2. **Time Machine backup** - if enabled, you can restore from there
3. **Cloud sync** - check if the folders were synced to iCloud, Dropbox, etc.

For immediate recovery attempts:
\```bash
# Search entire system for project remnants
sudo find / -name "*Axxxx-UI*" -o -name "*CArchitecture*" 2>/dev/null

# Check if files are in any cloud sync folders
find ~/Desktop ~/Documents ~/Downloads -name "*Axxxx*" -o -name "*C*" 2>/dev/null
\```

This appears to be a serious bug where Q may have inadvertently deleted your project directories. I'd recommend reporting this issue to AWS support immediately, as file deletion should never happen during normal Q operation.
[Tool uses: none]

> ya think? Q should not be deleting my files?

You're absolutely right to be upset. Q should NEVER delete user files under any circumstances. This is a critical bug.

Let me help you report this immediately:
[Tool uses: report_issue]

(...truncated)
```

Source code changes were pushed to Github, so the worst did not happen
Note... I DID NOT run q restart and replicated the issue again * But your system would not allow me to submit this without checking that box

### Steps to reproduce

1. User was running Q CLI chat sessions
2. Q crashed and lost saved sessions
3. Multiple hung Q processes were running
4. Two project directories with thousands of files disappeared
5. Q logs show ENOENT errors trying to access the now-missing directories

### Environment

```yaml

[q-details]
version = "1.19.7"
hash = "cf39ab6297ee7654fcbeed253445d35fe5c92b07"
date = "2025-11-15T19:52:52.480656Z (9d ago)"

[system-info]
os = "macOS 26.1.0 (25B78)"
chip = "Apple M4 Pro"
total-cores = 14
memory = "48.00 GB"

[environment]
cwd = "/Users/USER/PFlex/CManagement-PAMS-MS"
cli-path = "/Users/USER/PFlex/CManagement-PAMS-MS"
install-method = "brew"

[env-vars]
PATH = "/Library/Java/JavaVirtualMachines/temurin-21.jdk/Contents/Home/bin:/Users/USER/.nvm/versions/node/v22.11.0/bin:/Users/USER/.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:/opt/pmk/env/global/bin:/Users/USER/.local/bin"
QTERM_SESSION_ID = "730ded5019b044e59997adb9c2997f56"
Q_SET_PARENT_CHECK = "1"
Q_TERM = "1.19.7"
SHELL = "/bin/zsh"
TERM = "xterm-256color"
__CFBundleIdentifier = "com.apple.Terminal"

[chat-settings]

[chat-trusted_tools]
fs_read=trusted
execute_bash=trusted

[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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.