Bug: Multi-Client VSCode Connection Does Not Work

Resolved 💬 3 comments Opened Jan 12, 2026 by DarKWinGTM Closed Feb 27, 2026

Bug: Multi-Client VSCode Connection Does Not Work

Environment:

  • Claude Code CLI: 2.1.5
  • Command: ~/.bun/bin/claude
  • VS Code Extension: v2.1.5
  • OS: Linux

---

Expected Behavior (per Release Note v2.0.60)

EXPECTED: Multiple Terminal Clients Connect Simultaneously

Terminal 1                    VSCode IDE Server                    Terminal 2
    │                                │                                │
    ├─ /ide ────────────────────────►│                                │
    │  "connect request"             │                                │
    │                                │                                │
    │◄────────────────────────────────┼─ "initialize" ────────────────│
    │  "connection established"       │                                │
    │                                │                                │
    │                                │◄───── /ide ────────────────────│
    │                                │      "connect request"         │
    │                                │                                │
    │                                │◄──── "initialize" ─────────────│
    │  "connection established" ◄──────│                                │
    │                                │                                │
    └────────────────────────────────►│  Active (2 clients)           │
         Shared session              │◄───────────────────────────────┘
                                      │         Active (2 clients)

---

Actual Behavior

ACTUAL: Second Client Immediately Disconnects

Terminal 1                    VSCode IDE Server                    Terminal 2
    │                                │                                │
    ├─ /ide ────────────────────────►│                                │
    │  "connect request"             │                                │
    │                                │                                │
    │◄────────────────────────────────┼─ "initialize" ────────────────│
    │  "connection established"       │                                │
    │                                │                                │
    │                                │◄───── /ide ────────────────────│
    │                                │      "connect request"         │
    │                                │                                │
    │                                │         ✗ 33ms later           │
    │                                │                                │
    │                                │◄──── DISCONNECT (1006) ───────│
    │                                │      "code=1006"               │
    │                                │                                │
    │                                │         ❌ Client 2 failed     │
    │                                │                                │
    └────────────────────────────────►│  Active (1 client only)       │
         Shared session              │                                │
                                      │                                │

---

Connection Flow Comparison

Client 1 (Success)

CLIENT 1 CONNECTION FLOW

Step 1: User types /ide
    │
    ▼
Claude Code CLI
    │
    ├── Establish WebSocket to VSCode IDE Server
    │
    ▼
Send: { "method": "initialize", ... }
    │
    ▼
IDE Server
    ├── Accept connection
    ├── Cache initialize response
    ├── Send initialize result back
    │
    ▼
Claude Code CLI
    ├── Receive: { "result": { "capabilities": {...} } }
    ├── Send: { "method": "notifications/initialized" }
    │
    ▼
✅ STATUS: "Connected to Visual Studio Code."
    │
    └── Client 1 is now active and can use IDE features

Client 2 (Failed)

CLIENT 2 CONNECTION FLOW

Step 1: User types /ide
    │
    ▼
Claude Code CLI
    │
    ├── Establish WebSocket to VSCode IDE Server
    │
    ▼
IDE Server
    ├── Accept connection
    ├── Check: upstreamConnected=true, cacheAvailable=true
    │
    ▼
Claude Code CLI
    ├── Send: { "method": "initialize", ... }
    │
    ▼
IDE Server
    ├── Respond with cached initialize result
    │
    ▼
Claude Code CLI
    ├── Receive response
    │
    ├── ✗ IMMEDIATE DISCONNECT (33ms)
    ├── WebSocket close code: 1006
    ├── wasInitialized: false
    ├── wasSubscribed: false
    │
    ▼
❌ STATUS: Connection failed, no detailed error

---

Key Observations

| Aspect | Client 1 | Client 2 |
|--------|----------|----------|
| Connection | ✅ Established | ✅ Established |
| WebSocket | ✅ Open | ✅ Open then Close |
| Initialize | ✅ Success | ✅ Sent but immediately closed |
| Time to Disconnect | - | ❌ 33ms |
| Close Code | - | 1006 |
| wasInitialized | true | false |
| wasSubscribed | true | false |
| Error Messages | None | None |

---

Technical Analysis

What This Suggests:

HYPOTHESIS 1: Client-side Logic Rejects Connection
    │
    ├── CLI checks for existing IDE connections
    ├── Detects Client 1 is connected
    ├── Decides to reject Client 2
    └── Sends WebSocket close before completing handshake

HYPOTHESIS 2: Session Management Conflict
    │
    ├── Both clients share same session ID
    ├── Second connection triggers session collision
    └── CLI terminates to prevent conflicts

HYPOTHESIS 3: IDE Server Lock
    │
    ├── First client acquires lock
    ├── Second client blocked
    └── Lock mechanism disconnects instead of queuing

---

Steps to Reproduce

# Terminal 1
~/.bun/bin/claude
> /ide
# Output: "Connected to Visual Studio Code." ✅

# Terminal 2 (while Terminal 1 is connected)
~/.bun/bin/claude
> /ide
# Output: "Connected to Visual Studio Code." ❌
# Or: Immediate disconnect, no clear error

---

Additional Context

  • Single client: Works perfectly
  • Multi-client: Second client immediately disconnects
  • No error messages: CLI does not provide clear indication of why connection failed
  • Consistent behavior: Reproducible across multiple attempts

---

Expected Fix

Multi-client connections should work as announced:

  • Both clients can connect simultaneously
  • Each client can use IDE features (diff view, file operations, etc.)
  • Clear error message if multi-client is intentionally not supported

---

Reference

  • Feature announcement in v2.0.60 release notes:

"VSCode: Added support for multiple terminal clients connecting to the IDE server simultaneously"

View original on GitHub ↗

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