Fix Claude Code Crashing in VS Code (2026)
Claude Code crashing inside VS Code is usually caused by memory limits, extension conflicts, or terminal misconfiguration. This guide walks through each cause and gives you a fix that gets Claude Code stable in VS Code.
The Problem
You run Claude Code from VS Code’s integrated terminal and it crashes — either Claude Code itself freezes and dies, or the entire VS Code window becomes unresponsive. This may happen immediately on launch or after running for a while during a complex coding session.
Quick Solution
Step 1: Increase VS Code’s memory limit. Create or edit argv.json:
# macOS/Linux
code ~/.vscode/argv.json
Add or update the max memory setting:
{
"max-memory": 8192
}
Restart VS Code.
Step 2: Check for extension conflicts. Disable all other extensions temporarily:
code --disable-extensions
Launch Claude Code in the terminal. If it works, re-enable extensions one by one to find the conflict. Common culprits: other AI coding assistants (Copilot, Cody, Continue) competing for resources.
Step 3: Use an external terminal. Open your system terminal (Terminal.app on macOS, gnome-terminal on Linux) and run Claude Code from there:
cd /path/to/your/project
claude
If Claude Code works fine in an external terminal but crashes in VS Code, the issue is VS Code’s terminal environment.
Step 4: Fix VS Code’s terminal environment. Ensure your shell profile is sourced correctly. In VS Code settings (settings.json):
{
"terminal.integrated.env.osx": {
"ANTHROPIC_API_KEY": "sk-ant-your-key"
},
"terminal.integrated.shellArgs.osx": ["-l"]
}
The -l flag ensures your shell runs as a login shell, sourcing your profile.
Step 5: Kill zombie processes. If VS Code freezes entirely (not just Claude Code), the issue is likely VS Code’s PTY process:
pkill -f "claude"
Then reopen VS Code.
How It Works
Claude Code runs as a Node.js process inside VS Code’s integrated terminal. VS Code’s terminal is a pseudo-terminal (PTY) managed by VS Code’s Electron process. When Claude Code makes heavy API calls and processes large responses with streaming output, it puts load on both the Node.js process and VS Code’s PTY renderer. If VS Code’s Electron process runs out of memory (it shares a V8 heap with extensions, the editor, and the terminal), everything freezes.
Common Issues
Environment variables not loaded. VS Code’s integrated terminal may not source ~/.zshrc or ~/.bashrc properly. If ANTHROPIC_API_KEY is not available, Claude Code may crash on startup. Use terminal.integrated.env in VS Code settings or switch to a login shell.
Competing AI extensions. Running Claude Code alongside GitHub Copilot, Cody, or other AI extensions doubles the memory usage and can cause VS Code to run out of heap space. Disable competing extensions while using Claude Code.
Large workspace with many open files. If VS Code has many files open and large Git diffs loaded, there is less memory available for Claude Code. Close unused tabs and editors before starting a Claude Code session.
Best Practices
- Use an external terminal for long sessions. VS Code’s integrated terminal is convenient but adds overhead. For sessions over 30 minutes or heavy refactoring, use a dedicated terminal window.
- Set VS Code max-memory to at least 8GB. The default is 4GB, which is not enough when running Claude Code alongside other extensions.
- Disable competing AI extensions. You only need one AI assistant active at a time. Disable Copilot and similar extensions when using Claude Code to free up memory.
- Keep VS Code updated. VS Code’s terminal handling and memory management improve with each release.
- Monitor memory usage. If VS Code’s memory usage climbs above 6GB, wrap up your current task and restart VS Code before it crashes.
Example CLAUDE.md Section
# VS Code Integration
## Terminal Setup
- Run Claude Code in VS Code integrated terminal
- Shell: zsh with login flag (-l) for full profile sourcing
- Environment: ANTHROPIC_API_KEY set in terminal.integrated.env
## Memory Management
- VS Code max-memory set to 8192 in argv.json
- Close unused editor tabs before starting Claude Code sessions
- Disable competing AI extensions (Copilot, Cody) during Claude Code use
## Crash Recovery
- If VS Code freezes: force quit and reopen (Cmd+Q on macOS)
- If only Claude Code crashes: run `pkill -f claude` then restart
- Check git status after any crash for partial file writes
- Alternative: run Claude Code in external terminal for stability
FAQ
Why does Claude Code crash in VS Code but work in a regular terminal?
VS Code’s integrated terminal shares memory with the editor, extensions, and all open tabs. A regular terminal gives Claude Code dedicated resources without competition. Additionally, VS Code may not load your shell profile correctly, causing missing environment variables.
Will disabling GitHub Copilot help with Claude Code crashes?
Yes. Copilot and Claude Code both use significant memory. Running both simultaneously in VS Code can push total memory usage above the heap limit. Disable Copilot while using Claude Code for best stability.
How do I increase VS Code memory beyond 8GB?
Edit ~/.vscode/argv.json and set "max-memory": 16384 for 16GB. However, if you need more than 8GB, consider using an external terminal for Claude Code instead, as VS Code was not designed to handle that much memory usage.
I spent hours fighting VS Code crashes before I wrote a CLAUDE.md that configures memory limits and terminal settings automatically. Now every project just works.
I run 5 Claude Max subs, 16 Chrome extensions serving 50K users, and bill $500K+ on Upwork. These CLAUDE.md templates are what I actually use.