[BUG] Claude won't start "SandboxDEB is not valid JSON" error

Status Closed — not planned
Maintainer reply None cached
Activity 15 comments · opened Nov 20, 2025 · closed Mar 20, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

Sandbox debug output breaks JSON stream communication in WSL2 Debian, causing repeated crashes

Environment

  • Claude Code Version: 2.0.47
  • VS Code Version: 1.106.1
  • OS: WSL2 - Debian GNU/Linux 13 (trixie)
  • Kernel: Linux 6.6.87.2-microsoft-standard-WSL2
  • Architecture: x64
  • Extension Path: /home/ryan/.vscode-server/extensions/anthropic.claude-code-2.0.47-linux-x64

Description

The Claude Code extension repeatedly crashes with a JSON parse error in a specific project directory. The error occurs every time the extension initializes, creating an infinite crash/restart loop that renders the extension completely unusable in the affected directory.

Error Message:

SyntaxError: Unexpected token 'S', "[SandboxDeb"... is not valid JSON

Root Cause

The Claude Code native binary's sandbox initialization outputs debug messages to stdout:

[SandboxDebug] [Sandbox Linux] Seccomp filtering not available (missing binaries for x64). Sandbox will run without Unix socket blocking (allowAllUnixSockets mode). This is less restrictive but still provides filesystem and network isolation.

Even though the binary is invoked with --output-format stream-json and --debug-to-stderr, this debug message is being written to stdout instead of stderr, corrupting the JSON stream that the VS Code extension host is attempting to parse.

Steps to Reproduce

  1. Open VS Code in WSL2 Debian environment
  2. Navigate to a project directory (in my case: /home/ryan/01_SW_DEV_PROJECTS/03_ANALYTICS)
  3. Launch Claude Code extension
  4. Observe immediate crash with JSON parse error
  5. Process exits with code 143 (SIGTERM) and attempts to restart
  6. Crash repeats infinitely

Log Evidence

From /home/ryan/.vscode-server/data/logs/20251117T135829/exthost30/Anthropic.claude-code/Claude VSCode.log:

2025-11-19 19:13:49.516 [info] From claude: [SandboxDebug] [Sandbox Linux] Seccomp filtering not available (missing binaries for x64). Sandbox will run without Unix socket blocking (allowAllUnixSockets mode). This is less restrictive but still provides filesystem and network isolation.
2025-11-20T03:13:49.516Z [DEBUG] Getting matching hook commands for SessionStart with query: startup
2025-11-20T03:13:49.516Z [DEBUG] Found 0 hook matchers in settings
2025-11-20T03:13:49.516Z [DEBUG] Matched 0 unique hooks for query "startup" (0 before deduplication)

2025-11-19 19:13:49.518 [info] From claude: 2025-11-20T03:13:49.518Z [DEBUG] Getting matching hook commands for SessionEnd with query: other
2025-11-20T03:13:49.518Z [DEBUG] Found 0 hook matchers in settings
2025-11-20T03:13:49.518Z [DEBUG] Matched 0 unique hooks for query "other" (0 before deduplication)

2025-11-19 19:13:49.529 [info] From claude: 2025-11-20T03:13:49.528Z [DEBUG] Cleaned up session snapshot: /home/ryan/.claude/shell-snapshots/snapshot-bash-1763608428837-fmky72.sh
2025-11-20T03:13:49.529Z [DEBUG] LSP server manager shut down successfully

2025-11-19 19:13:49.658 [info] From claude: Claude Code process exited with code 143
2025-11-19 19:13:49.676 [info] Closing Claude on channel: pu49pbq0obk
2025-11-19 19:13:49.676 [error] Error from Claude (on channel pu49pbq0obk): SyntaxError: Unexpected token 'S', "[SandboxDeb"... is not valid JSON

Binary Invocation

The extension spawns the binary with:

/home/ryan/.vscode-server/extensions/anthropic.claude-code-2.0.47-linux-x64/resources/native-binary/claude \
  --output-format stream-json \
  --verbose \
  --input-format stream-json \
  --debug \
  --debug-to-stderr \
  --enable-auth-status

Note that --debug-to-stderr is explicitly specified, but the sandbox debug message still appears on stdout.

Expected Behavior

  • Debug messages should only be written to stderr when --debug-to-stderr flag is used
  • stdout should exclusively contain valid JSON when --output-format stream-json is specified
  • No debug/diagnostic messages should corrupt the JSON stream

Actual Behavior

  • Sandbox debug messages are written to stdout
  • VS Code extension host attempts to parse the debug message as JSON
  • Parse fails with "Unexpected token 'S'"
  • Process terminates and restarts in infinite loop
  • Extension is completely unusable

Impact

  • Severity: Critical - Extension completely broken in affected directories
  • Users cannot use Claude Code at all in affected projects
  • No workaround available (tried adding statusLine config, fixing permissions, etc.)
  • Other project directories work fine, suggesting directory-specific trigger

Additional Context

Why this happens specifically in some directories and not others: Unknown, but potentially related to:

  • Sandbox initialization differences based on project structure
  • Timing of when the debug message is emitted vs JSON parsing
  • Directory permissions or file contents triggering different code paths

Related observations:

  • The message indicates: "Seccomp filtering not available (missing binaries for x64)"
  • This suggests the sandbox is looking for x64 seccomp binaries that don't exist in the extension bundle
  • The sandbox falls back to "allowAllUnixSockets mode" but the debug output breaks the JSON stream

Suggested Fix

  1. Ensure all sandbox initialization debug output respects --debug-to-stderr flag
  2. Never write non-JSON content to stdout when --output-format stream-json is active
  3. Consider bundling the missing x64 seccomp binaries to avoid the warning entirely
  4. Add output stream validation to catch any accidental stdout contamination

Workaround

None found. Extension is completely unusable in affected directories.

What Should Happen?

Claude Should work

Error Messages/Logs

SyntaxError: Unexpected token 'S', "[SandboxDeb"... is not valid JSON
Troubleshooting resources

Steps to Reproduce

Claude should work.

Claude Model

None

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.0.47

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

Terminal.app (macOS)

Additional Information

  1. Open VS Code in WSL2 Debian environment
  2. Navigate to a project directory (in my case: /home/ryan/01_SW_DEV_PROJECTS/03_ANALYTICS)
  3. Launch Claude Code extension
  4. Observe immediate crash with JSON parse error
  5. Process exits with code 143 (SIGTERM) and attempts to restart
  6. Crash repeats infinitely

View original on GitHub ↗

15 Comments

github-actions[bot] · 9 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/12005
  2. https://github.com/anthropics/claude-code/issues/11828
  3. https://github.com/anthropics/claude-code/issues/11940

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

schergr · 9 months ago

Same issue

quovai · 9 months ago

Downgraded to 2.0.37 to make it work.

haisim-y · 9 months ago
Downgraded to 2.0.37 to make it work.

yup . this works for me too.

Shadetail · 8 months ago

Windows 11 + VS Code extension: stdout contamination from config errors → “Unexpected token 'C' … not valid JSON”

I hit the same “SyntaxError: Unexpected token 'C', "Claude con"... is not valid JSON” banner in the VS Code extension (tested on Windows 11; extension versions 2.0.62 and 2.0.49 — downgrade didn’t help).

In my case it’s triggered by the Claude config file state:

  • Claude logs show ConfigParseError with JSON Parse error: Unrecognized token '' (looks like UTF-8 BOM / bad leading char in %USERPROFILE%\.claude.json).
  • When the config is missing/corrupted, the binary prints human-readable messages like:
  • Claude configuration file not found at: C:\Users\...\ .claude.json ...
  • and/or “Config file corrupted, resetting to defaults…”

to stdout, not stderr.

Because the VS Code extension spawns the binary with --output-format stream-json, any plaintext on stdout breaks the JSON stream and causes the extension host to throw the “Unexpected token 'C'” parse error (first character of “Claude …”).

Workaround that fixed it for me: kill claude.exe, then recreate %USERPROFILE%\.claude.json as UTF-8 without BOM containing just {} (2 bytes: 7B 7D). After that the banner disappeared.

github-actions[bot] · 7 months ago

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

sjachille · 6 months ago

Started yesterday afternoon (GMT+0) around 5 PM - I am on a Mac, and this is the error message:

CLI output was not valid JSON. This may indicate an error during startup. Output: sandbox-helper: failed to start command: fork/exec /usr/local/lib/node_modules_global/bin/srt: no such file or directory.

In this thread, there is mention of downgrading to 2.0.37 - what exactly needs to be downgraded? I'm not a programmer, nor am I very familiar with OS, but I do have a general basic Python knowledge.

Thanks for helping!

marcelino056 · 6 months ago

Getting this, is the first time that i test cowork on windows

CLI output was not valid JSON. This may indicate an error during startup. Output: sandbox-helper: failed to unmount host share (tried both virtiofs and Plan9): invalid argument
ravivasavan · 6 months ago

Getting this error in every new Cowork tasks since this afternoon.

<img width="595" height="123" alt="Image" src="https://github.com/user-attachments/assets/344a5747-b7df-47d9-bc4e-0917f3beeb0f" />

CLI output was not valid JSON. This may indicate an error during startup. Output: sandbox-helper: failed to start command: fork/exec /usr/local/lib/node_modules_global/bin/srt: no such file or directory

ayush-patel · 6 months ago

I am also getting the same error on cowork tasks since two days. I am on the latest version.

sjachille · 6 months ago

I solved the problem - here's how (MacOS):

Force VM Rebuild
Try deleting the VM bundle to force Claude to rebuild it with fresh binaries:

  • Quit Claude Desktop
  • Open Terminal and run these commands:
  • # Backup the VM bundle (just in case)

cp -r ~/Library/Application\ Support/Claude/vm_bundles/claudevm.bundle ~/Library/Application\ Support/Claude/vm_bundles/claudevm.bundle.backup

Delete the VM bundle to force rebuild

rm -rf ~/Library/Application\ Support/Claude/vm_bundles/claudevm.bundle

andersbc · 6 months ago

same error -win 11

CPKINKEAD · 6 months ago
# I solved the problem - here's how (MacOS): Force VM Rebuild Try deleting the VM bundle to force Claude to rebuild it with fresh binaries: Quit Claude Desktop Open Terminal and run these commands: * # Backup the VM bundle (just in case) cp -r ~/Library/Application\ Support/Claude/vm_bundles/claudevm.bundle ~/Library/Application\ Support/Claude/vm_bundles/claudevm.bundle.backup # Delete the VM bundle to force rebuild rm -rf ~/Library/Application\ Support/Claude/vm_bundles/claudevm.bundle

this worked for me

github-actions[bot] · 5 months ago

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

github-actions[bot] · 5 months ago

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.