[BUG] Extension fails to activate: "TypeError: Invalid value for env" (command 'claude-vscode.editor.openLast' not found)
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:
- Install the Claude Code extension on VS Code (Windows).
- Launch VS Code.
- Try to open or use Claude.
- 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:
- Install the Claude Code extension on VS Code (Windows).
- Launch VS Code.
- Try to open or use Claude.
- 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" />
3 Comments
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 of1), 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
1caused Electron's internal utility process initialization to throwTypeError: Invalid value for envand 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):
A manual workaround made by users is not a fix - the plugin should not break and fail to open for such a trivial cause
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.