[BUG] Windows 11 / v2.1.142: JSON Parse error during init - Unexpected identifier "C" after bash-path detection (telemetry dropped)
Preflight Checklist
- [x] I have searched existing issues and this isn't covered by #53087 or #49522 (see Related below).
- [x] This is a single bug report.
- [x] 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
configureGlobalMTLS→configureGlobalAgents→ 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:
- The Windows path is properly escaped (
C:\\Users\\…) beforeJSON.parse(), or - 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 - The error-log sink + telemetry logger are initialized before this JSON.parse, so the
internal_errorevent 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
- Windows 11 with VS Code + Anthropic.claude-code extension and Git for Windows installed at the default location (
C:\Program Files\Git). - Open any new Claude Code session (the VS Code extension command).
- Tail the
Anthropic.claude-code.Claude VSCode.logoutput channel as the session starts. - The
[ERROR] SyntaxError: JSON Parse error: Unexpected identifier "C"line lands ~10ms afterError log sink initializedon the very first init pass.
The error reproduces on every fresh session start in this environment.
Suggested Fix
- Identify the
JSON.parse()call nearcli.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 ofJSON.parse(bashPath)). - Move event-logger init before this
JSON.parse, so theinternal_errortelemetry event for this kind of failure isn't dropped — that's exactly the signal Anthropic would want for diagnosing this class of bug.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗