[BUG] Claude stops with snapshot error
Environment
- Platform (select one):
- [x] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [x] Other: Pro max plan, not billed per API usage
- Claude CLI version: 1.0.24 (Claude Code)
- Operating System: macOS 15.5 (24F74)
- Terminal: Terminal 2.14
Bug Description
Steps to Reproduce
- I have not been able to reproduce the issue
Expected Behavior
Claude does not get stuck in a loop with:
⏺ Bash(npm test client-server)
⎿ Error: zsh:source:1: no such file or directory: /var/folders/qc/hn57tpxs7tg5842pdqg075vc0000gn/T/claude-shell-snapshot-c1b9
⏺ Bash(npm test client-server)
⎿ Error: zsh:source:1: no such file or directory: /var/folders/qc/hn57tpxs7tg5842pdqg075vc0000gn/T/claude-shell-snapshot-c1b9
⏺ Bash(npm test client-server)
⎿ Error: zsh:source:1: no such file or directory: /var/folders/qc/hn57tpxs7tg5842pdqg075vc0000gn/T/claude-shell-snapshot-c1b9
⏺ Bash(npm test client-server)
⎿ Error: zsh:source:1: no such file or directory: /var/folders/qc/hn57tpxs7tg5842pdqg075vc0000gn/T/claude-shell-snapshot-c1b9
Actual Behavior
Claude was no longer able to execute any shell commands, every shell command attempted produce the "no such file or directory.
Additional Context
I did have 104GB free on my drive. I suspect there is some cleanup operation, and it seems unlikely to be a macOS one from my naive understanding, but I really know nothing about this.
d0e33c75-2e65-425a-8bb5-146e87c1d570.jsonl.txt
relevant text from claude from my perspective.txt
As seen in the screenshot, Claude said "You could report this as a bug", so I did.
I've noticed the same thing. It seems to happen when you return to an old session. Restarting the session fixes it.
Interesting.
In my case there was a less than 30 minute, perhaps 5 minute (just guessing based on memory) delay between when the shell was working and when it stopped working. It was all within one prompt response from Claude. It was working when Claude first started responding and part way through the response its "shell" broke.
The .jsonl log I attached might confirm this? I don't know what all is included in those logs, or if there is a different one I should attach.
I'm experiencing the same issue. For me, it happens even in fresh sessions and is often so persistent that opening new sessions doesn't resolve it.
Details
I initially suspected it was due to working with multiple Claude Code sessions simultaneously (using git worktrees), but testing after killing all Claude processes showed this wasn't the cause. I also found stale processes in Activity Monitor after closing sessions, but killing them didn't help either.
Honestly, this happens more often than not for me.
The only reason I'm still using Claude Code is my recent Max plan subscription - Cursor seems more expensive currently, but that might change.
I also suspected it might be related to using ZSH with oh-my-zsh (saw someone mention this), but it occurs in bash too.
Actually, I didn't know how to switch to bash in my particular scenario.
Solution
I created a completely separate, streamlined environment specifically for Claude Code:
- Uses bash instead of zsh
- No Homebrew or mise contamination
- Only direct installations of required tools (Node.js, etc.)
- Force Claude Code to run through bash with export SHELL=/bin/bash
It's not ideal, but it works reliably, and I'll keep it this way until this gets resolved in Claude Code.
Also suffering this issue when claude code shells are left idle.
Feels good to know I'm not alone. If I restart the terminal window and Claude code, does it still have access to the prior session context?
You can use /resume command to continue one of the previous sessions.
There's even -c flag (claude -c) to resume the very last one.
It worked for a while, but since one of the latest updates (maybe 1.0.38), it doesn't work even with the fix (https://github.com/anthropics/claude-code/issues/2139#issuecomment-2994060105).
Sometimes it runs a command, but after a few commands, it stops working. Or sometimes doesn't work at all. Only restarting helps, but that's far from ideal for any longer work.
I can confirm I run into this error. It appears to only happen when CC is updated in the background, and your active session is using an old version.
I'm seeing this error too, but it seems to happen all the time (after a minute or two of coding) - not just when CC is updated in the background. I've tried to use bash as the shell (rather than zsh) and this doesn't seem to make any difference
Same for me. After a few minutes of usage, Claude Code becomes pretty much useless to me. Can't wait for opencode to reach feature parity. I won't touch Claude Code. I'm even considering going back to Cursor at this point :/
I switched from Cursor to Claude Code 2-3 weeks ago, and in total, I've had it working for maybe 3 days in total. Everything else was a struggle. I'll try using Docker containers. If that doesn't work, bye bye Claude Code.
It took me a while to set Docker containers up, but even there, I have this issue. It's crazy. I've tried 3 kinda completely different environments and I still get this issue. And I'm not the only one. So I'm pretty sure now it's not PEBCAK.
Let me know if you need any additional info about my environment. Until then, I'll be using opencode.
This happens to me anytime I close the session and reopen it without restarting the entire terminal. Would nice to be able to manually clear those snapshot temp files or something. For reference, I use Kitty terminal
Guys, I think you need to hear this.
As someone who's been struggling with this for the past few weeks, this morning I switched to opencode and I have the same feeling of leveling up like I've had when I moved from Cursor's Chat to Claude Code.
Ramble
The reason I hesitated switching so much was that I have a pretty complex automated workflow.It involves creating a new Cursor/VS Code workspace for every feature I work on, deals with memory files (plans, contexts...), and runs tests/code checks as part of the feedback loop.
So I asked opencode to convert my scripts. After like 15 minutes and just one small manual change, I can now switch from Claude Code to opencode and back easily. I don't even care what's driving the agent as long as it works.
Hopefully, one day, this bug in Claude Code gets fixed, and then I'll only care which model I'll be using, not the terminal tooling.
But if all goes well with opencode, I don't think I'll come back.
Anyway, try opencode. You'll thank me later.
Thanks Almir. I just heard about this: https://github.com/NomenAK/SuperClaude - seems to sit on top of Claude code - maybe through this you may not have the same issues...
As of v1.0.48 we moved the shell snapshot to ~/.claude/shell-snapshots
This should make it easier to inspect and even edit the shell snapshot.
It should also prevent the OS from cleaning up the snapshot while you're using it.
Can you please test and let us know how it goes?
Doesn't show up anymore. Thanks!
still shows up for me even after repeated restarts
@shallow-alchemy can you post the new error message?
Yeah. I just noticed its slightly different now
Want me to open a new issue? (to be clear, the missing error seems resolved)
interesting, can you please post the relevant line from that file? here's fine