Where does the bug appear (feature/product)?
Cursor IDE
Describe the Bug
In the post, include:
Title: e.g. “Agent terminal wrapper: ‘An item with the same key has already been added’ when capturing env”
What happens: When the AI runs a terminal command, the output shows a PowerShell error from the wrapper script: Get-ChildItem Env: | Sort-Object Name fails with “An item with the same key has already been added.”
What you’ve ruled out: Running the same command yourself in Cursor’s terminal works; Get-ChildItem Env: | Group-Object Name | Where-Object { $_.Count -gt 1 } shows no duplicate env vars in your session.
Conclusion: The failure only happens when the agent runs the command (different process/wrapper), not in your normal terminal.
Cursor version: Your Cursor version (e.g. from Help → About).
Steps to Reproduce
above
Expected Behavior
no error reported
Screenshots / Screen Recordings
Operating System
Windows 10/11
Version Information
Version: 2.4.28 (user setup)
VSCode Version: 1.105.1
Commit: f3f5cec40024283013878b50c4f9be4002e0b580
Date: 2026-02-03T00:56:18.293Z
Build Type: Stable
Release Track: Default
Electron: 39.2.7
Chromium: 142.0.7444.235
Node.js: 22.21.1
V8: 14.2.231.21-electron.0
OS: Windows_NT x64 10.0.26200
For AI issues: which model did you use?
?
For AI issues: add Request ID with privacy disabled
?
Does this stop you from using Cursor
No - Cursor works, but with this issue
