claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[BUG] Cowork VM disk full on session start - ENOSPC blocks all Bash commands

Open defilippomj opened this issue 8 months ago • 7 comments

Environment

  • Session: determined-keen-albattani
  • Project: PowerPoint Generator
  • Model: claude-opus-4-6
  • Platform: macOS (Cowork)
  • Date: 2026-03-22

Description

The Cowork VM internal disk is completely full at session start. Every Bash tool invocation fails before executing any command because the tool infrastructure cannot create its required temp directory. No shell commands can run at all - not even diagnostic commands like df -h.

Error

Every Bash call fails identically with:

ENOSPC: no space left on device, mkdir '/sessions/determined-keen-albattani/tmp/claude-XXXX'

This occurs before the user command executes. The mkdir is performed by the Bash tool infrastructure itself, not the user command.

Key Facts

  • Bash was broken from the very first command. Zero successful Bash calls in the entire session.
  • The session directory is nearly empty. Glob confirms only dotfiles (.profile, .bashrc, .bash_logout) and the mounted user folder exist. No node_modules, no build artifacts, no PDFs, no leftover files.
  • The /sessions/.../tmp/ directory is empty.
  • The mounted folder (user Mac filesystem) has plenty of space. Write tool successfully creates files on the mount.
  • /dev/shm has available space. Write tool can create files there. But the Bash tool temp directory path is hardcoded to the session path.
  • Zero builds were attempted. This was a fresh session with no prior work done.

Diagnosis

The disk was full before the session started. Since the session directory is clean and no user activity occurred, the problem is in the base image or container runtime - either the image is too large for the disk allocation, the disk quota is too small, or ephemeral storage was not provisioned.

Impact

Complete blocker for any task requiring shell execution:

  • Node.js builds (npm install, node scripts)
  • Package installation (npm, pip)
  • Python script execution
  • File conversions (LibreOffice, pdftoppm)
  • Git operations
  • All diagnostic commands (df, ls, rm, du)

Tools that still work: Read, Write, Edit, Glob, Grep, MCP tools.

Workaround

Built a full 22-slide PptxGenJS presentation by writing scripts to the mounted Mac folder and executing them via mcp__Control_your_Mac__osascript (do shell script). This works but is significantly slower and more fragile.

Reproduction Steps

  1. Open Cowork mode with the PowerPoint Generator project
  2. Try any Bash command: ls, df -h, echo test
  3. All fail with: ENOSPC: no space left on device, mkdir '/sessions/determined-keen-albattani/tmp/claude-XXXX'
  4. Confirm Write tool works on mounted folder but not on session directory
  5. Confirm /dev/shm has available space via Write tool

Suggestions

  1. Configurable TMPDIR for Bash tool - allow temp directory creation at /dev/shm/ or /tmp/ instead of /sessions/.../tmp/
  2. Disk space monitoring - surface df -h in session metadata
  3. Auto-cleanup on session start
  4. Increase disk allocation for build-heavy workflows
  5. Pre-install common tools (LibreOffice, pdftoppm) in the VM image

defilippomj avatar Mar 22 '26 22:03 defilippomj

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/37514
  2. https://github.com/anthropics/claude-code/issues/28128
  3. https://github.com/anthropics/claude-code/issues/28230

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

github-actions[bot] avatar Mar 22 '26 22:03 github-actions[bot]

Same issue here.

  • Platform: macOS (Darwin 25.0.0)
  • Session: peaceful-festive-clarke (ID: 97a026c0-b87f-4712-9320-0c8f04c5180f)
  • Date: 2026-03-24
  • Conversation length at failure: 1 message (first interaction)

Uploaded a small .docx file (~50KB privacy policy), asked Claude to analyze it. Every bash command failed immediately with:

ENOSPC: no space left on device, mkdir '/sessions/peaceful-festive-clarke/tmp/claude-1160'

The Bash tool fails at infrastructure level (can't create its own temp dir), so no command ever reaches execution. Claude entered an unrecoverable loop (~15 attempts). Non-bash tools (Read, Glob, Grep) still worked fine.

Suspect cause: plugin/npm artifacts pre-loaded in the sandbox consuming all space before user interaction:

  • /sessions/peaceful-festive-clarke/.npm/
  • /sessions/peaceful-festive-clarke/mnt/.local-plugins/

Had to abandon the session entirely.

capazme avatar Mar 24 '26 15:03 capazme

This is a known failure mode where the VM's sessiondata.img has filled up completely, so even fresh session starts fail immediately. The ENOSPC isn't from your current work — it's accumulated from all previous sessions.

Fix:

  1. Quit Claude fully — Cmd+Q
    1. Run in Terminal:
  2. rm -rf ~/Library/Application\ Support/Claude/vm_bundles/
    1. Reopen Claude — it rebuilds a clean image (~12MB) Alternatively, if you want to preserve something from the old image first:
mv ~/Library/Application\ Support/Claude/vm_bundles/claudevm.bundle/sessiondata.img \
   ~/Desktop/sessiondata.img.bak
# Reopen Claude, verify it works, then:
rm -f ~/Desktop/sessiondata.img.bak  # reclaims ~8.5GB

Your workspace files (in the Claude folder) are safe either way — only the VM session state resets.


Root cause: Plugin cache directories accumulate per-session and are never cleaned. After ~80 sessions the image is completely full, and useradd can't create a home directory for new sessions.

We built vm-disk-cleanup — a Cowork plugin that detects this exact scenario on startup and guides you through the correct fix. It also does routine maintenance to slow the accumulation down.

📦 Now in the Anthropic plugin marketplace: https://github.com/anthropics/claude-plugins-official/issues/1027 🔗 GitHub repo: https://github.com/msmobileapps/vm-disk-cleanup-plugin

msmobileapps avatar Mar 26 '26 16:03 msmobileapps

Reproducing on Windows / Cowork — April 17, 2026

Same issue, different root cause detail that may help the team.

Account: [email protected] Platform: Windows (Cowork desktop app) Disk status: /dev/sdc 9.8G 9.3G 21M 100% /sessions

Root cause confirmed by investigation: The /sessions ext4 volume accumulates one directory per session and never cleans them up. In my case, 341 session directories have built up since March 30, 2026.

The tricky part: du -sh /sessions/ reports only 6.2MB while df reports 9.3GB used. This is not deleted-open-files (checked with lsof +L1 — none found). The real cause is Unix permissions: each session runs as a unique uid (e.g. uid=1379(compassionate-exciting-meitner)), and all other session dirs have drwxr-x--- nobody nogroup permissions. The current session user simply cannot read or delete any other session's data.

Reopening old chats does NOT help — each reopen creates a brand-new session with a new uid, not the original one.

Result: ~9.3GB of orphaned data is permanently unrecoverable from within any session. Only an infrastructure-level cleanup can fix it.

Request:

  1. Manual reset of the /sessions disk for my account (immediate)
    1. Automatic TTL-based cleanup of session directories (e.g. after 48h) to prevent recurrence Happy to provide more diagnostics if useful.

Francesco-Bonetti avatar Apr 17 '26 05:04 Francesco-Bonetti

Workaround: Use an external VPS as a substitute sandbox

Same issue here — /sessions disk at 100%, Bash tool completely blocked.

Root cause (confirmed): The /sessions filesystem (ext4, ~10GB) accumulates data from hundreds of old sessions that are never cleaned up. In our case we found 421 session directories dating back to March 17, consuming ~9.3GB with 0 bytes free. Individual session dirs are locked (drwxr-x---, owned by their session user), so the current session cannot clean them up.

Workaround that works for us: Use an external VPS as a substitute sandbox via SSH.

Since paramiko can be installed to /tmp (which is on the root filesystem /dev/nvme0n1p1 at ~82%, not the full /sessions volume), SSH connections to an external server are possible:

import sys
sys.path.insert(0, '/tmp/pylib')
# pip3 install paramiko -t /tmp/pylib --quiet
import paramiko

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('your.vps.ip', username='root', password='yourpass', port=22)
stdin, stdout, stderr = ssh.exec_command("your command here")
print(stdout.read().decode())
ssh.close()

Our VPS (Hetzner, Ubuntu 22.04) has Python 3.12, pip 24, 52GB free — it becomes the full execution environment. All shell commands, pip installs, script execution, and file operations run there instead of the broken sandbox.

Limitations: Files created on the VPS don't land directly in the user's mounted folder. But they can be retrieved via SSH or served over HTTP.

This isn't a fix — Anthropic needs to implement session cleanup on the /sessions volume. But it unblocks work completely while waiting for a real fix.

👍 on the issue for visibility.

grimonprezedition-art avatar May 12 '26 06:05 grimonprezedition-art

Platform: macOS Claude desktop, Cowork mode. VM bundle at ~/Library/Application Support/Claude/vm_bundles/claudevm.bundle, sessiondata.img ~10 GB backing the shared /sessions volume (~9.8G visible in-sandbox).

Root cause (matches this issue): every Cowork session creates /sessions/<session>/ on the shared volume and the supervisor never reaps it. Our workspace runs heavy Python deps and 2–3 concurrent sessions; we hit 100% full roughly weekly. 228 leaked dirs going back ~10 weeks were observed on one incident.

Escalation timeline (one workspace):

  • 2026-04 onward — recurring: at ~10–15 accumulated sessions, pip ENOSPCs at bootstrap.
  • 2026-05-09 — 100% full. Recovery (app relaunch) wiped a parallel in-flight session in the same workspace.
  • 2026-05-12 — 100% full blocks even cleanup: deleting a 0-byte stale git lock fails at the syscall level (Operation not permitted on rm).
  • 2026-06-02, 6:00am — new severity rung: a scheduled (unattended) task's VM never booted. Every bash call returned "Workspace still starting" for ~20 minutes of retries. All in-sandbox mitigations are structurally unreachable when the VM won't start. The run failed silent: its only output was an in-chat report no one was awake to see.
  • 2026-06-02, later — app relaunch did NOT recover it. Mac reboot did NOT recover it (the full sessiondata.img persists across both).
  • 2026-06-02, latest — full bundle replacement (quit app, mv claudevm.bundle aside, relaunch rebuilds a fresh empty image): the freshly rebuilt VM still would not boot across ~28 spaced retries in the next session. It started working again at some later point with no identified action. So there is a second wedge mode beyond image fullness — likely host-side supervisor/VM-service state.

What still works with the VM dead: the Read/Write file tools and the workspace mount. We now use that path to drop machine-readable status breadcrumbs, plus host-side launchd jobs that alert on missed runs and rotate the bundle on size. These are workarounds; the leak and the opaque boot failure are the product issues.

Asks, in preference order:

  1. Reap per-session dirs at session end, or at next session start before new writes. Prevention beats recovery.
  2. Per-session ephemeral volumes instead of one shared image, so one session's accumulation can't starve another's bootstrap.
  3. Soft eviction at 80% of the shared volume (oldest non-active dirs first) with a user-facing notification. Active sessions never evicted.
  4. Diagnosability (new): when the VM can't boot, surface the reason ("session volume full", "VM service unavailable") instead of an indefinite "Workspace still starting". Document the supported recovery. The rebuilt-bundle-won't-boot mode above shows even aggressive manual recovery isn't reliably sufficient, and users get zero signal about why.

Reproduce (leak): open a Cowork session in a workspace with heavy pip deps, run a dependency-installing bootstrap, close the session (no app relaunch), repeat ~10–15×. df -h /sessions between runs shows monotonic growth; the supervisor never reclaims closed sessions' dirs.

Related: boot-failure symptom cluster #55649, #56145, #56566, #57968, #58368 (mostly Windows/Hyper-V — different stack, same "VM won't boot, no in-session recovery" class).

kylemcc3 avatar Jun 10 '26 01:06 kylemcc3

Platform: macOS Claude desktop, Cowork mode. VM bundle at ~/Library/Application Support/Claude/vm_bundles/claudevm.bundle, sessiondata.img ~10 GB backing the shared /sessions volume (~9.8G visible in-sandbox).

Root cause (matches this issue): every Cowork session creates /sessions// on the shared volume and the supervisor never reaps it. Our workspace runs heavy Python deps and 2–3 concurrent sessions; we hit 100% full roughly weekly. 228 leaked dirs going back ~10 weeks were observed on one incident.

The supervisor reaps NEITHER VM volume (2026-06-10). The VM root volume / (~9.6G, backed by rootfs.img) is a second leak surface: each session gets a fresh uid (1040, 1043, 1044 observed), so anything a session writes to per-uid paths on / — we had redirected pip caches to /var/tmp to protect /sessions — orphans when the uid is reclaimed. The orphans become nobody:nogroup, and the sticky bit on /var/tmp makes them undeletable by every later uid. Tenant-side cleanup is structurally impossible: a later session cannot remove a former session's root-volume state, and only bundle replacement reclaims it.

Escalation timeline (one workspace):

2026-04 onward — recurring: at ~10–15 accumulated sessions, pip ENOSPCs at bootstrap. 2026-05-09 — 100% full. Recovery (app relaunch) wiped a parallel in-flight session in the same workspace. 2026-05-12 — 100% full blocks even cleanup: deleting a 0-byte stale git lock fails at the syscall level (Operation not permitted on rm). 2026-06-02, 6:00am — new severity rung: a scheduled (unattended) task's VM never booted. Every bash call returned "Workspace still starting" for ~20 minutes of retries. All in-sandbox mitigations are structurally unreachable when the VM won't start. The run failed silent: its only output was an in-chat report no one was awake to see. 2026-06-02, later — app relaunch did NOT recover it. Mac reboot did NOT recover it (the full sessiondata.img persists across both). 2026-06-02, latest — full bundle replacement (quit app, mv claudevm.bundle aside, relaunch rebuilds a fresh empty image): the freshly rebuilt VM still would not boot across ~28 spaced retries in the next session. It started working again at some later point with no identified action. So there is a second wedge mode beyond image fullness — likely host-side supervisor/VM-service state. 2026-06-10 — third failure signature, VM root volume full while /sessions was healthy (9%): bash failed with RPC error: ensure user: useradd failed ... /etc/passwd: No space left on device. Orphaned prior-uid /var/tmp dirs (~1.6 GB across uids 1040/1043/1044, nobody:nogroup, sticky-bit-undeletable) had filled / to 100%, at which point user creation itself fails and new sessions get no shell at all — unlike "Workspace still starting", which at least names the VM as the problem, this surfaces as a raw RPC error. Two boots lost in one morning; bundle replacement recovered it (fresh bundle regenerated in ~4 min and booted this time). What still works with the VM dead: the Read/Write file tools and the workspace mount. We now use that path to drop machine-readable status breadcrumbs, plus host-side launchd jobs that alert on missed runs and rotate the bundle on size. These are workarounds; the leak and the opaque boot failure are the product issues.

Asks, in preference order:

Reap per-session state on BOTH volumes at session end, or at next session start before new writes — /sessions// dirs AND per-uid root-volume state (/var/tmp, /tmp, home dirs of reclaimed uids). Prevention beats recovery, and for the root volume the tenant has no recovery at all (sticky bit + uid churn). Per-session ephemeral volumes instead of one shared image, so one session's accumulation can't starve another's bootstrap. Soft eviction at 80% of the shared volume (oldest non-active dirs first) with a user-facing notification. Active sessions never evicted. Diagnosability (new): when the VM can't boot, surface the reason ("session volume full", "root volume full", "VM service unavailable") instead of an indefinite "Workspace still starting" — and note that the root-volume-full mode doesn't even get that string, just a raw useradd ... No space left on device RPC error. Document the supported recovery. The rebuilt-bundle-won't-boot mode above shows even aggressive manual recovery isn't reliably sufficient, and users get zero signal about why. Reproduce (leak): open a Cowork session in a workspace with heavy pip deps, run a dependency-installing bootstrap, close the session (no app relaunch), repeat ~10–15×. df -h /sessions between runs shows monotonic growth; the supervisor never reclaims closed sessions' dirs.

Related: boot-failure symptom cluster #55649, #56145, #56566, #57968, #58368 (mostly Windows/Hyper-V — different stack, same "VM won't boot, no in-session recovery" class).

kylemcc3 avatar Jun 10 '26 14:06 kylemcc3

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

github-actions[bot] avatar Jul 19 '26 22:07 github-actions[bot]

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

github-actions[bot] avatar Sep 16 '26 14:09 github-actions[bot]