[BUG] Linux/KDE/Wayland: Starting claude from VS Code integrated terminal spawns 2 extra VS Code windows
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported for Linux/Wayland yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
Discovery
This issue was identified and analyzed by Claude Sonnet 4.6 (claude-sonnet-4-6) running as Claude Code itself, during a debugging session in the affected environment.
Related Issues
This is the Linux/Wayland equivalent of the Windows bug fixed in v2.1.70:
- #30975 — Windows: 3 empty VS Code windows on startup from integrated terminal
- #31080 — duplicate
- #31280 — duplicate
- #32705 — duplicate (with root cause analysis)
The Windows fix addressed the issue for non-Linux platforms. The Linux/Wayland case was never addressed.
What's Wrong?
Starting claude from VS Code's integrated terminal on KDE/Wayland causes 2 extra VS Code windows to open on every startup.
Root Cause (based on v2.1.88 decompiled source — please verify against v2.1.150)
getInstallationEnv() in src/utils/ide.ts clears DISPLAY='' on Linux to prevent the GUI from launching, but does not clear WAYLAND_DISPLAY. On a Wayland session, Electron ignores DISPLAY and uses WAYLAND_DISPLAY to open a window.
// src/utils/ide.ts
function getInstallationEnv() {
if (getPlatform() === 'linux') {
return {
...process.env,
DISPLAY: '', // ← clears X11 only
// WAYLAND_DISPLAY not cleared — Electron still opens on Wayland
}
}
return undefined
}
Each of the following calls spawns a new VS Code window via Wayland:
code --list-extensionscode --list-extensions --show-versionscode --force --install-extension anthropic.claude-code(triggered every startup because installed extension version < CLI version)
Proposed Fix
Either clear WAYLAND_DISPLAY alongside DISPLAY, or apply the same ELECTRON_RUN_AS_NODE=1 fix used for Windows to Linux as well:
function getInstallationEnv() {
if (getPlatform() === 'linux') {
return {
...process.env,
DISPLAY: '',
WAYLAND_DISPLAY: '', // add this
ELECTRON_RUN_AS_NODE: '1', // or this (same fix as Windows)
}
}
return { ...process.env, ELECTRON_RUN_AS_NODE: '1' }
}
Steps to Reproduce
- KDE Plasma on Wayland (Fedora or similar)
- Open VS Code
- Open VS Code's integrated terminal
- Run
claudein any project directory - Observe: 2 extra VS Code windows appear
Environment
- OS: Fedora / KDE Plasma / Wayland (
WAYLAND_DISPLAY=wayland-0,DISPLAY=:0) - Claude Code CLI: 2.1.150
- VS Code extension: 2.1.145
- Terminal detection:
TERM_PROGRAM=vscode→isSupportedTerminal()returns true → auto-install triggers
Evidence
VS Code log directory shows rapid consecutive empty sessions on every claude startup:
~/.config/Code/logs/20260524T132012/ (empty)
~/.config/Code/logs/20260524T132013/ (empty)
~/.config/Code/logs/20260524T132015/ (empty)
Pattern repeated multiple times, each cluster corresponding to a claude startup.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗