microsoft / microsoft/vscode

[Bug] Claude agent SDK crashes with "Error during execution" in Copilot Chat (VS Code 1.127.0, Electron 42 / Node 24)

Open
#325,711 3 comments 0 reactions 1 assignee Claimed by @roblourens View on GitHub
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

Type: Bug

Using Claude agent SDK in Copilot Chat crashes with `Error during execution`. The model call succeeds, but the post-processing in _processMessages throws after the ToolCallingLoop stops with reasons=undefined. Regular GitHub Copilot Chat/Agent (e.g. GPT-4o-mini or other claude models) works fine. The issue is specific to the ClaudeCodeSession agent SDK path.

Steps to Reproduce
1. VS Code 1.127.0 (Electron 42.2.0)
2. Open Copilot Chat, select Claude
3. Send any message that invokes the agent

Expected Behavior
Claude responds through the agent.

Actual Behavior
Error: Error during execution immediately after model responds successfully.

Logs
```
2026-07-13 11:49:31.765 [info] ccreq:b48651a0.copilotmd | success | claude-opus-4.6 -> claude-opus-4-6 | 5071ms | [panel/editAgent]
2026-07-13 11:49:31.839 [info] [AutomaticInstructionsCollector] Core vs extension instructions match (6 entries)
2026-07-13 11:49:35.305 [info] [ClaudeCodeSession] Passing 8 plugin(s) from skill locations
2026-07-13 11:49:36.521 [error] claude-agent-sdk stderr: (node:20815) [MODULE_TYPELESS_PACKAGE_JSON] Warning: Module type of file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/extensions/copilot/dist/cli.js is not specified and it doesn't parse as CommonJS.
Reparsing as ES module because module syntax was detected. This incurs a performance overhead.
To eliminate this warning, add "type": "module" to /Applications/Visual Studio Code.app/Contents/Resources/app/extensions/copilot/package.json.
2026-07-13 11:49:43.402 [info] ccreq:e04c33e6.copilotmd | success | claude-opus-4.6 -> claude-opus-4-6 | 8310ms | [panel/editAgent]
2026-07-13 11:49:43.408 [info] [ToolCallingLoop] Stop hook result: shouldContinue=false, reasons=undefined
2026-07-13 11:49:43.431 [error] Error: Error during execution
at bUo (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/copilot/dist/extension.js:2908:480)
at ubr (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/copilot/dist/extension.js:2908:691)
at n.invokeFunction (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/copilot/dist/extension.js:29:944)
at dV._processMessages (/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/copilot/dist/extension.js:2915:17122)
```

Analysis

The crash is in bUo() which throws when the result message has subtype === "success" && is_error === true. The function looks for a VSCODE_PROXY_ERROR: marker in the result text via hUo(), doesn't find one, and falls through to the generic "Error during execution" throw.

The bundled cli.js (Claude Code v2.1.112) uses ES module syntax but package.json lacks "type": "module", causing the MODULE_TYPELESS_PACKAGE_JSON warning on Node 24. This may cause the subprocess to report an error status despite successful completion.

Environment
VS Code: 1.127.0
Electron: 42.2.0 (Node ~24.x)
Copilot extension: 0.55.0
Bundled Claude Code CLI: 2.1.112
OS: macOS (arm64)

Related
I'm also seeing someone posted a similar issue today on anthropics/claude-code#77223

VS Code version: Code 1.127.0 (Universal) (4fe60c8b1cdac1c4c174f2fb180d0d758272d713, 2026-06-30T10:52:33+02:00)
OS version: Darwin x64 24.6.0
Modes:

System Info

|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz (12 x 2600)|
|GPU Status|2d_canvas: enabled
GPU0: VENDOR= 0x1002, DEVICE=0x7340, DRIVER_VENDOR=Intel, DRIVER_VERSION=15.7.7
GPU1: VENDOR= 0x8086, DEVICE=0x3e9b *ACTIVE*
Machine model name: MacBookPro
Machine model version: 16.1
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: enabled_on
trees_in_viz: disabled_off
video_decode: enabled
video_encode: enabled
webgl: enabled
webgpu: enabled
webnn: disabled_off|
|Load (avg)|4, 5, 5|
|Memory (System)|16.00GB (1.88GB free)|
|Process Argv|--crash-reporter-id f716c5cd-ac07-4e82-80f3-5fbcef357f7f --crash-reporter-id f716c5cd-ac07-4e82-80f3-5fbcef357f7f|
|Screen Reader|no|
|VM|0%|
Extensions (23)

Name|Identifier|Author|Version
---|---|---|---
GitHub Codespaces|github.codespaces|GitHub|1.18.15
GitHub Repositories|github.remotehub|GitHub|0.64.0
GitHub Actions|github.vscode-github-actions|github|0.32.1
GitHub Pull Requests|github.vscode-pull-request-github|GitHub|0.156.0
Symbols|miguelsolorio.symbols|miguelsolorio|0.0.26
Python Debugger|ms-python.debugpy|ms-python|2026.6.0
Python|ms-python.python|ms-python|2026.4.0
Pylance|ms-python.vscode-pylance|ms-python|2026.2.1
Python Environments|ms-python.vscode-python-envs|ms-python|1.36.0
Jupyter|ms-toolsai.jupyter|ms-toolsai|2025.9.1
Jupyter Keymap|ms-toolsai.jupyter-keymap|ms-toolsai|1.1.2
Jupyter Notebook Renderers|ms-toolsai.jupyter-renderers|ms-toolsai|1.3.0
Jupyter Cell Tags|ms-toolsai.vscode-jupyter-cell-tags|ms-toolsai|0.1.9
Jupyter Slide Show|ms-toolsai.vscode-jupyter-slideshow|ms-toolsai|0.1.6
Remote - SSH|ms-vscode-remote.remote-ssh|ms-vscode-remote|0.124.0
Remote - SSH: Editing Configuration Files|ms-vscode-remote.remote-ssh-edit|ms-vscode-remote|0.87.0
Live Preview|ms-vscode.live-server|ms-vscode|0.4.19
Remote Explorer|ms-vscode.remote-explorer|ms-vscode|0.5.0
Remote Repositories|ms-vscode.remote-repositories|ms-vscode|0.42.0
Shiny|posit.shiny|Posit|1.4.1
R|reditorsupport.r|REditorSupport|2.8.8
R Syntax|reditorsupport.r-syntax|REditorSupport|0.1.4
Cline|saoudrizwan.claude-dev|saoudrizwan|4.0.8

A/B Experiments

```
vsliv368cf:30146710
pythonvspyt551:31249599
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythonrdcb7:31342333
6518g693:31463988
aj953862:31281341
82j33506:31327384
6abeh943:31336334
envsactivate1:31538736
gh487529:31544284
cloudbuttont:31379625
3efgi100_wstrepl:31403338
ddidtcf:31399634
ec5jj548:31422691
cp_cls_t_966_ss:31526232
8hhj4413:31478653
ge8j1254_inline_auto_hint_haiku:31490510
38bie571_auto:31478677
cp_cls_t_1081:31454832
conptydll_true:31498968
ia-use-proxy-models-svc:31452481
e9c30283:31461165
test_treatment2:31471001
c9b86496:31447327
control_6dc23131:31544977
idci7584:31464702
e3e4d672:31494082
ei9d7968:31496641
nes-extended-on:31455476
chat:31457767
8hig5102:31480529
89g7j272:31518289
7e187181:31503455
i2gc6536:31499202
52612955:31516516
ghj88844:31499326
ec1eg703:31520046
ddid_c:31478207
hmra_i5g22:31518061
ie3bb177:31543534
7df3h592:31512476
cp_cls_t_1082:31535311
logging_enabled_new:31498466
j0d79568:31499440
jb_cp_cls_t_632:31543129
748c7209:31512887
32d76977:31512328
ha629193:31508444
cdk-lw-on:31524445
f9bf7985:31543584
a1ije391_t:31540920
api_cot_ctrl:31513533
g4a0e106:31529594
8hfba999:31537718
prpt_ctrl:31518467
jbcp_cls_pctr_t:31531130
61138546:31518536
cp_intellij_t_nes:31548657
d7b18187:31526828
nes-curr-leftover-1500:31538366
h561g132:31533256
sessions_3:31532893
ihg5j128:31534457
f412h606:31546039
9gg7f176:31542112
sandbox-ui-on-2:31543161
nes-nc-lc-nf:31546584

```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.