claude-code - 💡(How to fix) Fix [BUG] Linux/KDE/Wayland: Starting claude from VS Code integrated terminal spawns 2 extra VS Code windows

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Root Cause

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)

Fix Action

Fixed

  • Closed with commit: b42360f3ae4d659e39f672d9ff466a857ef9981a

Code Example

// 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
}

---

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' }
}

---

~/.config/Code/logs/20260524T132012/  (empty)
~/.config/Code/logs/20260524T132013/  (empty)
~/.config/Code/logs/20260524T132015/  (empty)
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported for Linux/Wayland yet
  • This is a single bug report
  • 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:

  1. code --list-extensions
  2. code --list-extensions --show-versions
  3. code --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

  1. KDE Plasma on Wayland (Fedora or similar)
  2. Open VS Code
  3. Open VS Code's integrated terminal
  4. Run claude in any project directory
  5. 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=vscodeisSupportedTerminal() 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.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING