[BUG] Extension fails to activate: "TypeError: Invalid value for env" (command 'claude-vscode.editor.openLast' not found)

Status Fixed / completed
Maintainer reply None cached
Activity 3 comments · opened Jul 16, 2026 · closed Jul 16, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When launching VS Code with the Claude Code VS Code extension installed, the extension completely fails to activate. Trying to interact with the extension displays the error: command 'claude-vscode.editor.openLast' not found.

Upon inspecting the VS Code Developer Tools console, the actual root cause is that the VS Code Extension Host process crashes immediately during startup with a TypeError: Invalid value for env coming from Electron's internal utility process initialization.

Steps to reproduce:

  1. Install the Claude Code extension on VS Code (Windows).
  2. Launch VS Code.
  3. Try to open or use Claude.
  4. Error appears: command 'claude-vscode.editor.openLast' not found.

What Should Happen?

The VS Code Extension Host should start successfully, allowing the Claude extension to register its commands and activate normally so I can use the extension.

Error Messages/Logs

ERR Error received from starting extension host (kind: LocalProcess)
ERR TypeError: Invalid value for env
    at new ForkUtilityProcess (node:electron/js2c/browser_init:2:84047)
    at Object.fork (node:electron/js2c/browser_init:2:82259)
    at fs.doStart (file:///C:/Users/R****/AppData/Local/Programs/Microsoft VS Code/resources/app/out/main.js:450:12544)
    at fs.start (file:///C:/Users/R****/AppData/Local/Programs/Microsoft VS Code/resources/app/out/main.js:450:15813)

Steps to Reproduce

When launching VS Code with the Claude Code VS Code extension installed, the extension completely fails to activate. Trying to interact with the extension displays the error: command 'claude-vscode.editor.openLast' not found.

Upon inspecting the VS Code Developer Tools console, the actual root cause is that the VS Code Extension Host process crashes immediately during startup with a TypeError: Invalid value for env coming from Electron's internal utility process initialization.

Steps to reproduce:

  1. Install the Claude Code extension on VS Code (Windows).
  2. Launch VS Code.
  3. Try to open or use Claude.
  4. Error appears: command 'claude-vscode.editor.openLast' not found.

Claude Model

None

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

Latest VS Code Extension

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

The issue persists even after:

  • Reinstalling the extension and VS Code completely.
  • Downgrading the extension.
  • Trying both User and System installers of VS Code.

The crash happens within the VS Code Extension Host process itself (TypeError: Invalid value for env), which blocks all extensions from running.

<img width="2026" height="1368" alt="Image" src="https://github.com/user-attachments/assets/ca5679e0-76fe-4dd0-aca5-c21a412a0a4e" />

View original on GitHub ↗

3 Comments

RuddyCh · 3 months ago

Update: The issue is now completely resolved!

Root Cause

The crash was caused by a corrupt/rogue Windows environment variable named 1 (with a value of 1), likely left behind by a buggy installer script.

Because Node.js/Electron parses environment variables into a JavaScript object, having a purely numerical key like 1 caused Electron's internal utility process initialization to throw TypeError: Invalid value for env and crash the Extension Host immediately on startup.

Resolution

I ran the following PowerShell commands to delete this rogue variable from both the current session and the Windows Registry (User/Machine levels):

Remove-Item env:\1 -ErrorAction SilentlyContinue
[Environment]::SetEnvironmentVariable("1", $null, "User")
try { [Environment]::SetEnvironmentVariable("1", $null, "Machine") } catch {}

After removing the variable 1 and restarting VS Code, the extension host launched perfectly and the Claude extension is now fully functional.
I am closing this issue as resolved. Hopefully, this helps anyone else running into this obscure Electron crash on Windows!
rhengles · 2 months ago

A manual workaround made by users is not a fix - the plugin should not break and fail to open for such a trivial cause

github-actions[bot] · 17 days ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.