Skip to content

[Error] unhandlederror-Underlying ArrayBuffer has been detached from the view or out-of-bounds #314126

Closed

Description

@vs-code-engineering

Error Message

unhandlederror-Underlying ArrayBuffer has been detached from the view or out-of-bounds

Stack Trace

subarray@[native code] slice@https:/<REDACTED: user-file-path>:406:97195 read@https:/<REDACTED: user-file-path>:1032:107872 F9e@https:/<REDACTED: user-file-path>:1032:108816 onRawMessage@https:/<REDACTED: user-file-path>:1032:109925 _deliver@https:/<REDACTED: user-file-path>:405:3273 _deliverQueue@https:/<REDACTED: user-file-path>:405:3365 fire@https:/<REDACTED: user-file-path>:405:3705 fire@https:/<REDACTED: user-file-path>:1034:9642 _receiveMessage@https:/<REDACTED: user-file-path>:1034:14558 _deliver@https:/<REDACTED: user-file-path>:405:3273 fire@https:/<REDACTED: user-file-path>:405:3595 acceptChunk@https:/<REDACTED: user-file-path>:1034:6503 _deliver@https:/<REDACTED: user-file-path>:405:3273 fire@https:/<REDACTED: user-file-path>:405:3595 @https:/<REDACTED: user-file-path>:1:32394 @https:/<REDACTED: user-file-path>:1:616709 L@https:/<REDACTED: user-file-path>~pfHelper-_stream_readable.js.d012a863561ff856229c.js:1:2749 E@https:/<REDACTED: user-file-path>~pfHelper-_stream_readable.js.d012a863561ff856229c.js:1:2576 @https:/<REDACTED: user-file-path>:1:520455 @https:/<REDACTED: user-file-path>:1:520540 invoke@https:/<REDACTED: user-file-path>:1:602341 fire@https:/<REDACTED: user-file-path>:1:603070 handleDataReceived@https:/<REDACTED: user-file-path>~pfHelper-sshChannel.js.ab35c8076e00423ab703.js:1:5319 handleDataMessage@https:/<REDACTED: user-file-path>:1:116365 @https:/<REDACTED: user-file-path>~pfHelper-sshSession.js.4e4a205930fc96daa9a3.js:1:6558

Details

Property Value
Bucket ID 12b59e7b-e91b-7d00-3b08-8053104014cb
Version 1.119.0-insider
Commit 1d94ae1b
Last Seen Sun May 03 2026 23:15:44 GMT+0000 (Coordinated Universal Time)
Platforms Mac, Web
Product VSCode

This issue was automatically created from the VS Code Errors Dashboard

Activity

  1. added
    bug
    error-telemetry
    ai-generated
    on May 4, 2026
  2. vs-code-engineering commented on May 4, 2026

    @vs-code-engineering
    ContributorAuthor

    Regression Details

    • Product: VSCode
    • Regression type: new
    • Last release without this error: 1.118.1 stable
    • First release with this error: 1.119.0-insider
    • Commit range: compare
    • Affected users: 30
    • Platforms: Mac, Web

    Generated by errors-regression-scan · ● 4.5M · ◷

  3. ngxminhlong-spec commented on May 4, 2026

    @ngxminhlong-spec

    This looks like a regression in the Copilot Chat extension (v0.47.2026043003). The setItems method in l9e is likely failing because the upstream observable is returning a non-iterable value under certain network conditions or model responses on Win32.
    Needs deminification to pinpoint the exact reactive state causing this.

  4. vs-code-engineering commented on May 4, 2026

    @vs-code-engineering
    ContributorAuthor

    🔍 Error Investigation

    Summary

    The error "Underlying ArrayBuffer has been detached from the view or out-of-bounds" occurs in VS Code's IPC protocol layer (ChunkStream._read → VSBuffer.slice) when processing data from a Remote SSH port forwarding helper web worker. The entire call stack runs within the pfHelper worker context, where SSH channel data flows synchronously through a readable stream into the protocol reader. The failure happens because an ArrayBuffer backing a stored chunk becomes detached (transferred or neutered) before it is consumed by the deserialization code.

    Culprit Commit

    No culprit commit in VS Code core was identified. The core IPC protocol files (ipc.net.ts, ipc.mp.ts, buffer.ts) have not been modified in the regression window. The error originates from the Remote SSH extension's port forwarding helper (pfHelper-sshChannel.js, pfHelper-sshSession.js, pfHelper-_stream_readable.js) which runs as a web worker. A change in the Remote SSH extension likely began reusing or transferring ArrayBuffers before the protocol layer finishes consuming them. This is an external extension regression surfacing as a crash in VS Code core's buffer handling code.

    Code Flow

    sequenceDiagram
        participant SSH as "pfHelper SSH Session"
        participant Channel as "pfHelper SSH Channel"
        participant Stream as "pfHelper Readable Stream"
        participant Protocol as "ProtocolReader in ipc.net.ts"
        participant IPC as "ChannelServer in ipc.ts"
    
        SSH->>Channel: handleDataMessage
        Channel->>Stream: handleDataReceived pushes buffer
        Stream->>Protocol: acceptChunk fires data event
        Note over Protocol: ChunkStream stores buffer reference
        Protocol->>IPC: onMessage fires ProtocolMessage
        IPC->>IPC: onRawMessage calls deserialize
        Note over IPC: slice/subarray fails:<br/>ArrayBuffer is detached
    
    Loading

    Affected Files

    File Role
    src/vs/base/parts/ipc/common/ipc.net.ts Crash site — ChunkStream._read calls VSBuffer.slice on a detached buffer
    src/vs/base/parts/ipc/common/ipc.ts ChannelServer.onRawMessage triggers deserialization of the message
    pfHelper-sshChannel.js (Remote SSH ext) Root cause — provides data with a buffer that gets detached
    pfHelper-_stream_readable.js (Remote SSH ext) Data flow — readable stream passes buffer without copying

    Repro Steps

    1. Use VS Code for Web (vscode.dev) or VS Code on Mac with the Remote SSH extension
    2. Connect to a remote SSH host with port forwarding enabled
    3. Generate significant data traffic through the forwarded port (e.g., a web application serving responses)
    4. The error occurs when the SSH channel's data buffer is reused or detached before the protocol layer finishes reading from it

    Fix Proposal

    Fix location: src/vs/base/parts/ipc/common/ipc.net.ts → ChunkStream.acceptChunk() (defensive) or the Remote SSH extension's pfHelper code (preferred)

    Approach (defensive, in VS Code core): In ChunkStream.acceptChunk, defensively copy the incoming buffer's underlying data (VSBuffer.wrap(new Uint8Array(buff.buffer))) to ensure ChunkStream owns its buffers and is resilient to callers that reuse/transfer the ArrayBuffer after passing it.

    Approach (preferred, in Remote SSH extension): The Remote SSH extension's port forwarding helper should not reuse or transfer ArrayBuffers after passing them to the IPC protocol layer. The pfHelper code should .slice() the data before passing it downstream, or avoid using transferable buffers in its internal postMessage calls.

    Recommended Owner

    @alexdima — area owner of src/vs/base/parts/ipc/ (IPC protocol layer) and best positioned to decide whether a defensive copy should be added in core or whether this should be redirected to the Remote SSH extension team.

    Generated by errors-investigate · ● 15.9M · ◷

  5. added
    ai-analyzed
    on May 4, 2026
  6. vs-code-engineering commented on May 28, 2026

    @vs-code-engineering
    ContributorAuthor

    Related Error Buckets

    These additional error buckets are tracked by this issue (v1.121.0):

    Bucket ID Error Message Version
    9cf3c250 Underlying ArrayBuffer has been detached from the view or out-of-bounds 1.121.0

    Same root cause as 12b59e7b: subarray on a detached ArrayBuffer in the SSH port forwarding helper data path. Stable since 1.118, 13.5K users on 1.121.0 stable.

    Generated by errors-triage · ● 24.5M · ◷

  7. vs-code-engineering commented on May 29, 2026

    @vs-code-engineering
    ContributorAuthor

    Related Error Buckets

    These error buckets continue to appear in v1.122.0 (previously tracked since v1.121.0):

    Bucket ID Error Message Version
    9cf3c250 Underlying ArrayBuffer has been detached from the view or out-of-bounds 1.122.0

    Continues on stable 1.122.0 with 1.5K users. Same SSH port forwarding helper root cause.

    Generated by errors-triage · ● 16.8M · ◷

  8. vs-code-engineering commented on Jun 2, 2026

    @vs-code-engineering
    ContributorAuthor

    Related Error Buckets

    These error buckets continue to appear in v1.122.1 (previously tracked since v1.121.0):

    Bucket ID Error Message Version
    9cf3c250 Underlying ArrayBuffer has been detached from the view or out-of-bounds 1.122.1

    Continues on stable 1.122.1 with 5.9K users. Same SSH port forwarding helper root cause.

    Generated by errors-triage · ● 17.2M · ◷

  9. vs-code-engineering commented on Jun 4, 2026

    @vs-code-engineering
    ContributorAuthor

    Related Error Buckets

    These error buckets continue to appear in v1.123.0 (previously tracked since v1.121.0):

    Bucket ID Error Message Version
    9cf3c250 Underlying ArrayBuffer has been detached from the view or out-of-bounds 1.123.0

    Continues on stable 1.123.0 with 674 users. Same SSH port forwarding helper root cause.

    Generated by errors-triage · ● 15.7M · ◷

  10. vs-code-engineering commented on Jun 9, 2026

    @vs-code-engineering
    Author
  11. vs-code-engineering commented on Jun 11, 2026

    @vs-code-engineering
    ContributorAuthor

    Related Error Buckets

    These error buckets continue to appear in v1.124.0 (previously tracked since v1.121.0):

    Bucket ID Error Message Version
    9cf3c250 Underlying ArrayBuffer has been detached from the view or out-of-bounds 1.124.0

    Continues on stable 1.124.0 with 959 users. Same SSH port forwarding helper root cause.

    Generated by errors-triage · ● 29.3M · ◷

  12. alexdima commented on Jun 13, 2026

    @alexdima
    Member

    joshspicer My AI agent concludes that this is a problem with Remote SSH

    🤖

    Verdict: not a clear core fix — it's the Remote SSH extension

    The crash is subarray/slice on a detached ArrayBuffer inside ChunkStream._read (src/vs/base/parts/ipc/common/ipc.net.ts:219/221). acceptChunk just stores the incoming VSBuffer by reference:

    public acceptChunk(buff: VSBuffer) {
        this._chunks.push(buff);      // <- reference kept, not copied
        this._totalLength += buff.byteLength;
    }

    The key signal from the stack trace: every frame is in the pfHelper-* worker (pfHelper-sshChannel.js, pfHelper-_stream_readable.js, pfHelper-sshSession.js). Those are the Remote SSH extension's port-forwarding helper, which bundles its own copy of this IPC code. The extension pushes an SSH data buffer into the stream and then transfers/reuses that same ArrayBuffer (via a postMessage transfer list) before the protocol layer finishes reading it → the stored chunk gets neutered.

    That's why the AI investigation found no core culprit commit in the regression window — buffer.ts / ipc.net.ts / ipc.mp.ts weren't touched. I confirmed: no changes to those files in the 1.118.1→1.119.0 window.

    So your options

    1. Redirect to the Remote SSH team (recommended). The real fix is in their pfHelper: .slice() the SSH channel data before handing it to the stream, or stop putting that buffer in the postMessage transfer list. This is the correct owner and avoids penalizing all of core.

    2. Add a defensive copy in core ChunkStream.acceptChunk — resilient, but it forces a copy on every IPC chunk for all connections to paper over one extension's buffer misuse. I'd avoid this on such a hot path unless you want belt-and-suspenders.

    There isn't a "clean, obviously-correct, zero-cost" core change to make here. My recommendation is to reassign/redirect rather than land a defensive copy.

    Want me to draft a comment on the issue redirecting to the Remote SSH extension with this analysis, or would you prefer I implement the defensive copy in ChunkStream?

  13. vs-code-engineering commented on Jun 16, 2026

    @vs-code-engineering
    ContributorAuthor

    Related Error Buckets

    This error bucket continues to appear in v1.124.2 (previously tracked since v1.121.0):

    Bucket Error Message Version
    9cf3c250 Underlying ArrayBuffer has been detached from the view or out-of-bounds 1.124.2

    Continues on stable 1.124.2 (5,785 affected users / 461,740 hits). Root cause already identified in this issue as the Remote-SSH port-forwarding helper worker — the fix belongs in the Remote-SSH extension rather than core.

    Generated by errors-triage · 970.3 AIC · ⌖ 52.3 AIC · ⊞ 46.1K · ◷

  14. vs-code-engineering commented on Jun 16, 2026

    @vs-code-engineering
    ContributorAuthor

    Stable Release Anomaly Details

    This issue was matched and linked by the stable-release anomaly scan (consecutive stable comparison).

    • Anomaly type: new
    • Representative bucket: 4303df6f-8fa5-eee8-6a15-0f39995f938a (coalesced with 97d64c68)
    • Affected users: ~6,558 across the coalesced group (current stable 1.124.2)
    • Previous stable: 1.123.2
    • Current stable: 1.124.2
    • Commit range: 1.123.2...1.124.2

    Analysis: "ArrayBuffer is detached" surfaced as a new high-impact bucket in 1.124.2 (~6,558 users in the coalesced group), typically from accessing a transferred/neutered buffer after an async boundary.

    Generated by errors-stable-scan · 2.5K AIC · ⌖ 118.6 AIC · ⊞ 49.4K · ◷

  15. alexdima commented on Jun 18, 2026

    @alexdima
    Member

    Fixed via #321291

  16. added this to the milestone on Jun 18, 2026
  17. locked and limited conversation to collaborators on Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ai-analyzedai-generatedbugerror-telemetryrecent-regression

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions