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

Resolved 💬 15 comments Opened Nov 20, 2025 by tondeaf 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 ↗

This issue has 15 comments on GitHub. Read the full discussion on GitHub ↗