Where does the bug appear (feature/product)?
Cursor CLI
Describe the Bug
I used to have an environment system variable GEMINI_API_KEY in my Windows system. I created a node script to use Gemini API and set another GEMINI_API_KEY programmatically (i.e., in .env file). So, I removed the system env variable GEMINI_API_KEY from Windows. But when I run the script from CLI, it is still using the old value, not the new one from .env. I restarted IDE and Windows several times. The issue persists. I see process.env have the old value.
import dotenv from 'dotenv';
dotenv.config();
console.log(process.env); // process.env.GEMINI_API_KEY has the old value
When I tried in VS Code, it is fine and I found it uses the new value.
Steps to Reproduce
- Create a system environment variable in Windows, let’s say
GEMINI_API_KEY. - Create a node script that uses
.envwhich have the same var nameGEMINI_API_KEY. - Run the script and it will use
GEMINI_API_KEYfrom Windows. - Delete
GEMINI_API_KEYfrom Windows - Restart PowerShell, IDE, Windows, etc.
- Run the script again and it will still use
GEMINI_API_KEYfrom Windows.GEMINI_API_KEYfrom.envis never used.
Expected Behavior
After deleting GEMINI_API_KEY from Windows, I except GEMINI_API_KEY from .env to be used.
Operating System
Windows 10/11
Version Information
Version: 2.3.35 (system setup)
VSCode Version: 1.105.1
Commit: cf8353edc265f5e46b798bfb276861d0bf3bf120
Date: 2026-01-13T07:39:18.564Z
Electron: 37.7.0
Chromium: 138.0.7204.251
Node.js: 22.20.0
V8: 13.8.258.32-electron.0
OS: Windows_NT x64 10.0.26100
Does this stop you from using Cursor
No - Cursor works, but with this issue
