◉CLAUDE LABJP
●CC 2.1.332 — No new Claude Code release over the weekend. 2.1.332 (11/25) is still current●ANALYTICS — A fix to search counts in the Enterprise Analytics API may raise numbers from 11/17 onward●SONNET 4.5 — Today, 11/30, is Sonnet 4.5's last day on the Claude API. Move to claude-sonnet-5-5●USAGE — Some users report weekly usage jumping right after upgrading to a higher plan●NEW — New: Does what a Project remembers carry over into your everyday chats?●BILLING — More readers are looking for what to check when a payment won't go through●CC 2.1.332 — No new Claude Code release over the weekend. 2.1.332 (11/25) is still current●ANALYTICS — A fix to search counts in the Enterprise Analytics API may raise numbers from 11/17 onward●SONNET 4.5 — Today, 11/30, is Sonnet 4.5's last day on the Claude API. Move to claude-sonnet-5-5●USAGE — Some users report weekly usage jumping right after upgrading to a higher plan●NEW — New: Does what a Project remembers carry over into your everyday chats?●BILLING — More readers are looking for what to check when a payment won't go through
Articles/Claude Code
⟐ Claude Code/2026-03-26Beginner

Fixing ENOSPC Errors in Claude Code: A Hands-On Guide

ENOSPC errors in Claude Code and Cowork can stop your work cold. Drawing on the time I jammed my own four-site automation pipeline, here's how to find the cause, recover on the spot, and design so it never happens again.

claude-code135troubleshooting108enospcerror17disk-space

What's Actually Happening When ENOSPC Hits

One morning a scheduled task I run had gone silent halfway through. The log showed bash had simply stopped answering commands, and just before that, four short letters: ENOSPC. This was April 15, 2026.

ENOSPC stands for "No space left on device" — the filesystem has zero writable blocks remaining. In my case the direct culprit was an npm install buried in the pipeline. While updating four technical blogs in parallel, the node_modules folders across several repositories had quietly eaten the VM's ~10GB disk, and on one particular run they finally crossed the line.

Error: ENOSPC: no space left on device, write
  at Object.writeFileSync (fs.js:1234:15)
  at /workspace/debug.log

What makes this error nasty is that the instant it appears, everything freezes. You can't write logs, you can't save files, and git commit won't go through. Storage accumulates silently for a long time, then becomes a wall in a single moment — disk problems always arrive in that shape.

Why the Disk Fills Up — Three Usual Suspects

In the order I actually hit them:

1. Build artifacts and package caches piling up This was the heart of my incident. A single repo's node_modules can exceed 500MB, and build caches like .next regenerate repeatedly without ever being cleared. Move between several projects and it stacks up fast.

2. Runaway debug logging A stray print inside a loop reaches gigabytes after a few million iterations. A print inside while True: fills disk far faster than you'd expect.

3. Leftover temp files /tmp holds onto files from previous runs. Each one is tiny, but with frequent runs it adds up.

First, Find Where the Space Went

Before recovering, figure out what's swollen. Deleting on a hunch sweeps away things you needed.

df -h
du -sh ~/* 2>/dev/null | sort -rh | head -10

If df -h shows usage above 90%, you're critical. If node_modules, .next, or huge .log files sit at the top of du, that's your culprit. In my case, other sites' working repositories were occupying the top slots.

On-the-Spot Recovery Steps

Step 1: Shut down and restart Close Cowork or Claude Code completely, wait a few seconds, and reopen. Memory-resident temp files get released, and sometimes that alone is enough.

Step 2: Delete what's actually eating the space

# Find files over 1GB
find ~ -type f -size +1G 2>/dev/null
# Sweep old logs and build caches
find ~ -name "*.log" -mtime +30 -delete 2>/dev/null
find ~ -type d -name ".next" -exec rm -rf {} + 2>/dev/null

One caution here: don't casually re-run npm install at this stage. If a package cache is what filled the disk, reinstalling just pours fuel on the fire. That's the exact mistake I made the first time.

Step 3: Clear caches in bulk

npm cache clean --force
rm -rf ~/.cowork/cache

Step 4: When it still won't budge Use the menu → Cowork → Reset App Data to reset the app-side data (your project files stay protected). If even that doesn't resolve it, contact Anthropic Support (support@anthropic.com) with your usage percentage, the error message, and the timestamp.

Designing So It Never Jams Again — Three Things I Added to My Pipeline

Building structural safeguards beat ad-hoc cleanup by a wide margin over time. Both of my grandfathers were miyadaiku — traditional shrine carpenters — and growing up watching them maintain what they'd built so it would last for decades, I suppose I'm wired to put effort into "don't let it accumulate" design.

Design 1: I removed npm install from the pipeline entirely To merely add an article, you only need to fetch the repository, write the MDX, and push. The build can be left to Cloudflare's CI, so there was actually no need to create node_modules on the VM at all. That single change erased the biggest source of disk pressure. The most effective fix being "just don't do it" was a little ironic.

Design 2: Auto-free space when it drops below a threshold Before working, I measure free space, and if it's under 500MB I automatically reclaim it in order: other sites' working repos → npm build cache → global cache.

FREE_MB=$(df ~ --output=avail -m 2>/dev/null | tail -1 | tr -d ' ')
if [ "${FREE_MB:-0}" -lt 500 ]; then
  for OTHER in ~/repos/*; do
    [ "$OTHER" != "$WORK" ] && rm -rf "$OTHER" 2>/dev/null
  done
  npm cache clean --force 2>/dev/null
fi

Design 3: Build an escape route for unwritable locations When I hit an environment where /tmp was owned by another user and not writable, I made the workflow fall back to $HOME/repos. It's not ENOSPC itself, but it prevents getting doubly stuck — running out of writable space mid-recovery.

Your Next Move

Run df -h once in your current environment right now. If usage is past 50%, glance at the top of du -sh ~/* | sort -rh | head, and delete one stale node_modules or old log. That alone sharply cuts the odds of work freezing on a busy day. Ever since I made typing that one line a Monday-morning habit, ENOSPC redos have all but disappeared for me.

Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

⟐ Claude Code2026-05-24
When Claude Code's Sequential Edits Cascade into Failure — Fixing 'old_string not found' and 'not unique' on the Same File
Run several Edits against the same file and the second or third one fails with 'not found', 'Found 2 matches' or 'modified since read'. A triage table for five error messages, a match-counting script, when to use replace_all or sed, and moving formatter hooks to Stop.
⟐ Claude Code2026-05-02
Two Reasons Claude Code's Edit Tool Refuses — Multiple Matches vs. No Match
Claude Code's Edit tool fails in two distinct ways: the string matches in several places, or it matches nowhere. Here is how to tell them apart, how to build a good old_string, and how to check for formatters, line endings and invisible characters.
⟐ Claude Code2026-11-03
When Claude Code dies with a Bus error on a shared home directory, check this before you turn off auto-update
Why Claude Code crashes with a Bus error on an NFS-style shared home, how the official cleanup rule and update switches work, and two small scripts to check your setup.