claude-code - 💡(How to fix) Fix [BUG] Windows 11 / v2.1.142: JSON Parse error during init - Unexpected identifier "C" after bash-path detection (telemetry dropped)

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

2026-05-15T19:11:22.428Z [DEBUG] [init] configureGlobalMTLS starting 2026-05-15T19:11:22.428Z [DEBUG] [init] configureGlobalMTLS complete 2026-05-15T19:11:22.428Z [DEBUG] [init] configureGlobalAgents starting 2026-05-15T19:11:22.428Z [DEBUG] CA certs: stores=bundled,system, extraCertsPath=undefined 2026-05-15T19:11:22.429Z [DEBUG] CA certs: Loaded 145 bundled root certificates 2026-05-15T19:11:22.446Z [DEBUG] CA certs: Loaded 162 system CA certificates 2026-05-15T19:11:22.447Z [DEBUG] mTLS: Creating HTTPS agent with custom certificates 2026-05-15T19:11:22.447Z [DEBUG] [init] configureGlobalAgents complete 2026-05-15T19:11:22.449Z [DEBUG] Using bash path: "C:\Program Files\Git\bin\bash.exe" 2026-05-15T19:11:22.450Z [DEBUG] Error log sink initialized 2026-05-15T19:11:22.460Z [WARN] [3P telemetry] Event dropped (no event logger initialized): internal_error 2026-05-15T19:11:22.460Z [ERROR] SyntaxError: JSON Parse error: Unexpected identifier "C" at <parse> (:0) at parse (unknown) at rM$ (B:/~BUN/root/src/entrypoints/cli.js:182:10088) at _ (B:/~BUN/root/src/entrypoints/cli.js:138:18350) at <anonymous> (B:/~BUN/root/src/entrypoints/cli.js:184:1658) at <anonymous> (B:/~BUN/root/src/entrypoints/cli.js:19461:447) at processTicksAndRejections (native:7:39)

Root Cause

The error surfaces immediately after the bash-detection log line (Using bash path: "C:\Program Files\Git\bin\bash.exe"), which is the Windows-only branch that probes for Git's bundled bash. That timing strongly suggests the offending JSON.parse is consuming the resolved bash path (or a related Windows path) as if it were JSON content. The companion [WARN] [3P telemetry] Event dropped (no event logger initialized): internal_error line shows the runtime tried to fire an internal_error telemetry event for this failure but had to drop it because the event logger wasn't initialized yet.

Code Example

2026-05-15T19:11:22.428Z [DEBUG] [init] configureGlobalMTLS starting
2026-05-15T19:11:22.428Z [DEBUG] [init] configureGlobalMTLS complete
2026-05-15T19:11:22.428Z [DEBUG] [init] configureGlobalAgents starting
2026-05-15T19:11:22.428Z [DEBUG] CA certs: stores=bundled,system, extraCertsPath=undefined
2026-05-15T19:11:22.429Z [DEBUG] CA certs: Loaded 145 bundled root certificates
2026-05-15T19:11:22.446Z [DEBUG] CA certs: Loaded 162 system CA certificates
2026-05-15T19:11:22.447Z [DEBUG] mTLS: Creating HTTPS agent with custom certificates
2026-05-15T19:11:22.447Z [DEBUG] [init] configureGlobalAgents complete
2026-05-15T19:11:22.449Z [DEBUG] Using bash path: "C:\Program Files\Git\bin\bash.exe"
2026-05-15T19:11:22.450Z [DEBUG] Error log sink initialized
2026-05-15T19:11:22.460Z [WARN] [3P telemetry] Event dropped (no event logger initialized): internal_error
2026-05-15T19:11:22.460Z [ERROR] SyntaxError: JSON Parse error: Unexpected identifier "C"
    at <parse> (:0)
    at parse (unknown)
    at rM$ (B:/~BUN/root/src/entrypoints/cli.js:182:10088)
    at _ (B:/~BUN/root/src/entrypoints/cli.js:138:18350)
    at <anonymous> (B:/~BUN/root/src/entrypoints/cli.js:184:1658)
    at <anonymous> (B:/~BUN/root/src/entrypoints/cli.js:19461:447)
    at processTicksAndRejections (native:7:39)
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this isn't covered by #53087 or #49522 (see Related below).
  • This is a single bug report.
  • I am using the latest version of Claude Code (2.1.142, released 2026-05-14).

What's Wrong?

On Windows 11 + VS Code extension + Claude Code 2.1.142, an early-init JSON.parse() fires on a value that begins with C:\…, throwing a SyntaxError: JSON Parse error: Unexpected identifier "C" before the error-log sink is fully wired for telemetry. The error is non-fatal — the session continues — but it noisily pollutes the extension log channel on every session start.

The error surfaces immediately after the bash-detection log line (Using bash path: "C:\Program Files\Git\bin\bash.exe"), which is the Windows-only branch that probes for Git's bundled bash. That timing strongly suggests the offending JSON.parse is consuming the resolved bash path (or a related Windows path) as if it were JSON content. The companion [WARN] [3P telemetry] Event dropped (no event logger initialized): internal_error line shows the runtime tried to fire an internal_error telemetry event for this failure but had to drop it because the event logger wasn't initialized yet.

Related but distinct:

  • #53087 — same JSON.parse()-on-non-JSON shape, but in the MCP SDK OAuth-discovery code path (raw body "Not Found"Unexpected identifier "Not"). Different consumer.
  • #49522 — same Windows 11 init sequence and same configureGlobalMTLSconfigureGlobalAgents → bash-path → log-sink order, but in that issue the process dies silently after these lines. Here, the error is logged and the session continues to work. Likely the same Windows-init code region, different downstream behavior.

Environment

  • OS: Windows 11 Enterprise 10.0.26310
  • Claude Code: 2.1.142 (latest)
  • Channel: VS Code extension (Anthropic.claude-code)
  • Shell: PowerShell 7
  • Bash: Git for Windows at C:\Program Files\Git\bin\bash.exe
  • Node: 24+

Expected Behavior

Either:

  1. The Windows path is properly escaped (C:\\Users\\…) before JSON.parse(), or
  2. Whatever consumer is calling JSON.parse() here doesn't get fed a path string in the first place (e.g. it should be parsing the contents of a file, not the file path), or
  3. The error-log sink + telemetry logger are initialized before this JSON.parse, so the internal_error event isn't dropped.

Actual Behavior

Full snippet from Anthropic.claude-code.Claude VSCode.log:

2026-05-15T19:11:22.428Z [DEBUG] [init] configureGlobalMTLS starting
2026-05-15T19:11:22.428Z [DEBUG] [init] configureGlobalMTLS complete
2026-05-15T19:11:22.428Z [DEBUG] [init] configureGlobalAgents starting
2026-05-15T19:11:22.428Z [DEBUG] CA certs: stores=bundled,system, extraCertsPath=undefined
2026-05-15T19:11:22.429Z [DEBUG] CA certs: Loaded 145 bundled root certificates
2026-05-15T19:11:22.446Z [DEBUG] CA certs: Loaded 162 system CA certificates
2026-05-15T19:11:22.447Z [DEBUG] mTLS: Creating HTTPS agent with custom certificates
2026-05-15T19:11:22.447Z [DEBUG] [init] configureGlobalAgents complete
2026-05-15T19:11:22.449Z [DEBUG] Using bash path: "C:\Program Files\Git\bin\bash.exe"
2026-05-15T19:11:22.450Z [DEBUG] Error log sink initialized
2026-05-15T19:11:22.460Z [WARN] [3P telemetry] Event dropped (no event logger initialized): internal_error
2026-05-15T19:11:22.460Z [ERROR] SyntaxError: JSON Parse error: Unexpected identifier "C"
    at <parse> (:0)
    at parse (unknown)
    at rM$ (B:/~BUN/root/src/entrypoints/cli.js:182:10088)
    at _ (B:/~BUN/root/src/entrypoints/cli.js:138:18350)
    at <anonymous> (B:/~BUN/root/src/entrypoints/cli.js:184:1658)
    at <anonymous> (B:/~BUN/root/src/entrypoints/cli.js:19461:447)
    at processTicksAndRejections (native:7:39)

Hypothesis

The Unexpected identifier "C" shape means JSON.parse() was handed a bare string starting with C, not a quoted JSON value. The bash-path log line one millisecond earlier (C:\Program Files\Git\bin\bash.exe) is the strongest candidate for the offending value — that's a Windows-only diagnostic from a Windows-only init branch. On macOS/Linux the same defect would produce Unexpected token / (POSIX paths start with /); I couldn't find any matching open issue with that signature, weakly suggesting the bug is confined to Windows-specific code paths.

Steps to Reproduce

  1. Windows 11 with VS Code + Anthropic.claude-code extension and Git for Windows installed at the default location (C:\Program Files\Git).
  2. Open any new Claude Code session (the VS Code extension command).
  3. Tail the Anthropic.claude-code.Claude VSCode.log output channel as the session starts.
  4. The [ERROR] SyntaxError: JSON Parse error: Unexpected identifier "C" line lands ~10ms after Error log sink initialized on the very first init pass.

The error reproduces on every fresh session start in this environment.

Suggested Fix

  1. Identify the JSON.parse() call near cli.js:182:10088. If it's parsing a path-shaped string, switch to whatever produces that path's content instead (e.g. JSON.parse(await readFile(bashPath)) instead of JSON.parse(bashPath)).
  2. Move event-logger init before this JSON.parse, so the internal_error telemetry event for this kind of failure isn't dropped — that's exactly the signal Anthropic would want for diagnosing this class of bug.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Windows 11 / v2.1.142: JSON Parse error during init - Unexpected identifier "C" after bash-path detection (telemetry dropped)