Windows "Unable to resolve your shell environment in a reasonable time." when launched via shortcut
Type: Bug
Hi,
When I launch VS Code from a shortcut in Windows, I get:
2025-06-12 16:23:41.567 [error] Unable to resolve your shell environment in a reasonable time. Please review your shell configuration and restart.
2025-06-12 16:23:42.762 [error] resolving shell environment failed Unable to resolve your shell environment in a reasonable time
If I launch from the command line with code.cmd (or code-insiders.cmd) I don't receive this error. It tried passing --prof-startup to the .exe to get more details but it didn't profile.
My shell is PowersShell 7.5.1.
Thanks!
VS Code version: Code - Insiders 1.101.0-insider (dfaf44141ea9deb3b4096f7cd6d24e00c147a4b1, 2025-06-11T15:35:29.777Z) OS version: Windows_NT x64 10.0.26100 Modes:
System Info
| Item | Value |
|---|---|
| CPUs | Intel(R) Xeon(R) Gold 6240 CPU @ 2.60GHz (4 x 2594) |
| GPU Status | 2d_canvas: unavailable_software canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: disabled_software multiple_raster_threads: enabled_on opengl: disabled_off rasterization: disabled_software raw_draw: disabled_off_ok skia_graphite: disabled_off video_decode: disabled_software video_encode: disabled_software vulkan: disabled_off webgl: unavailable_software webgl2: unavailable_software webgpu: unavailable_software webnn: unavailable_software |
| Load (avg) | undefined |
| Memory (System) | 16.00GB (5.75GB free) |
| Process Argv | --crash-reporter-id 79dae070-e5f9-40b9-8421-24be045f4218 |
| Screen Reader | no |
| VM | 40% |
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyt551:31249597
vscod805cf:30301675
c4g48928:30535728
a9j8j154:30646983
962ge761:30841072
dsvsc014:30777825
dsvsc015:30821418
2e7ec940:31000449
pythontbext0:30879054
cppperfnew:30980852
dwnewjupytercf:31046870
pythonrstrctxt:31093868
nativeloc1:31118317
e80f6927:31120813
dwcopilot:31158714
5b1c1929:31184661
6074i472:31201624
dwoutputs:31242946
customenabled:31248079
hdaa2157:31222309
copilot_t_ci:31222730
g012b348:31231168
pythoneinst12:31251391
bgtreat:31252123
c7cif404:31309980
pythonpulldiag:31287486
6gi0g917:31259950
editoredits36407:31282444
996jf627:31264550
pythonrdcb7:31268811
usemplatestapi:31297334
e6194696:31317039
747dc170:31275146
pythoncompactctx:31296835
6518g693:31302842
pylancecolor:31288664
generatesymbolt:31280541
convertfstringf:31280702
gendocf:31280703
nes0dcc7202:31321960
923gi514:31310909
b99bg931:31306656
1cfa2231:31326675
convertlamdat:31319677
gce3e431:31315077
I experienced same issue on stable release.
The docs page linked with "Learn More" button saids,
This section applies to macOS and Linux environments only.
So it's maybe by some little mistake on platform check logic. It would be safe for Windows users to ignore the message I guess? Maintainers' confirmation would be highly appreciated.
same issue
2025-06-13 13:54:24.439 [error] Unable to resolve your shell environment in a reasonable time. Please review your shell configuration and restart.
2025-06-13 13:54:24.439 [error] resolving shell environment failed Unable to resolve your shell environment in a reasonable time. Please review your shell configuration and restart.
Are people able to get rid of this error when they increase the application.shellEnvironmentResolutionTimeout setting to a higher value?
For the 1.101 release we pushed support for resolving environment variables from the PowerShell profile, see https://code.visualstudio.com/updates/v1_101#_windows-shell-environment-discovery
I set application.shellEnvironmentResolutionTimeout to the max 120s and it still timed out.
Please see if you can find any logged output that could help us find the source of the issue:
- run
code --verbosefrom the command line - reproduce the issue
- attach the log files you find from running the command "Open Logs Folder"
@connor4312 this seems to hint to a problem that the command you create never returns
Yes, verbose logs would be appreciated, thanks!
See attached. Note, when launching from the command line, I cannot reproduce the issue. I appended --verbose to a copy of the shortcut's target (the .exe).
vscode-resolveShellEnv-windows-timeout.zip
Thanks for the logs. I'm curious what you see if you just open cmd.exe and run C:\Program Files\PowerShell\7\pwsh.exe -Command "Write-Output 'fda0bbe81247'; [System.Environment]::GetEnvironmentVariables() | ConvertTo-Json -Compress; Write-Output 'fda0bbe81247'" manually? (That's the command we're trying to run to get environment variables and is stalling)
Putting the Program FIles path in quotes, I get a pretty quick and successful return (my profile admittedly has some slow-ish thing in it but not 120 seconds slow):
>echo %TIME%
15:53:11.66
> "C:\Program Files\PowerShell\7\pwsh.exe" -Command "Write-Output 'fda0bbe81247'; [System.Environment]::GetEnvironmentVariables() | ConvertTo-Json -Compress; Write-Output 'fda0bbe81247'"
fda0bbe81247
{"TMP":"C:\\Users\\mySamAccountName\\AppData\\Local\\Temp","PSModulePath":"C:\\Users\\mySamAccountName\\OneDrive - myOrganizationName\\Documents\\PowerShell\\Modules;C:\\Program Files\\PowerShell\\Modules;c:\\program files\\powershell\\7\\Modules;C:\\Program Files (x86)\\WindowsPowerShell\\Modules;C:\\windows\\system32\\WindowsPowerShell\\v1.0\\Modules;C:\\Program Files\\WindowsPowerShell\\Modules;","CLIENTNAME":"myClientName","TEMP":"C:\\Users\\mySamAccountName\\AppData\\Local\\Temp","UATDATA":"C:\\windows\\CCM\\UATData\\myCcmUATDataGuid","OS":"Windows_NT","PROCESSOR_IDENTIFIER":"Intel64 Family 6 Model 85 Stepping 7, GenuineIntel","NUMBER_OF_PROCESSORS":"4","ProgramFiles(x86)":"C:\\Program Files (x86)","PROCESSOR_ARCHITECTURE":"AMD64","USERDOMAIN":"MYDOMAIN","USERNAME":"mySamAccountName","ProgramW6432":"C:\\Program Files","OneDriveCommercial":"C:\\Users\\mySamAccountName\\OneDrive - myOrganizationName","POWERSHELL_DISTRIBUTION_CHANNEL":"MSI:Windows 10 Enterprise","OneDrive":"C:\\Users\\mySamAccountName\\OneDrive - myOrganizationName","HOMEPATH":"\\Users\\mySamAccountName","CommonProgramFiles":"C:\\Program Files\\Common Files","COMPUTERNAME":"BUNK","PROMPT":"$P$G","HOMEDRIVE":"C:","DriverData":"C:\\Windows\\System32\\Drivers\\DriverData","APPDATA":"C:\\Users\\mySamAccountName\\AppData\\Roaming","SystemDrive":"C:","SESSIONNAME":"RDP-Tcp#0","USERPROFILE":"C:\\Users\\mySamAccountName","windir":"C:\\WINDOWS","LOCALAPPDATA":"C:\\Users\\mySamAccountName\\AppData\\Local","ALLUSERSPROFILE":"C:\\ProgramData","PROCESSOR_REVISION":"5507","SystemRoot":"C:\\WINDOWS","EFC_8412_1592913036":"1","USERDNSDOMAIN":"MY.DOMAIN.NAME","PATHEXT":".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL","SMS_ADMIN_UI_PATH":"C:\\Program Files (x86)\\Microsoft Endpoint Manager\\AdminConsole\\bin\\i386","CommonProgramFiles(x86)":"C:\\Program Files (x86)\\Common Files","PROCESSOR_LEVEL":"6","USERDOMAIN_ROAMINGPROFILE":"MYDOMAIN","ProgramFiles":"C:\\Program Files","ComSpec":"C:\\WINDOWS\\system32\\cmd.exe","Path":"C:\\Program Files\\PowerShell\\7;C:\\Program Files\\Microsoft SDKs\\Azure\\CLI2\\wbin;C:\\windows\\system32;C:\\windows;C:\\windows\\System32\\Wbem;C:\\windows\\System32\\WindowsPowerShell\\v1.0\\;C:\\windows\\System32\\OpenSSH\\;C:\\Program Files\\Microsoft VS Code\\bin;C:\\Program Files (x86)\\Microsoft SQL Server\\160\\DTS\\Binn\\;C:\\Program Files\\SysinternalsSuite;C:\\Program Files\\WindowsPowerShell\\Modules;C:\\Program Files\\WinGet\\Links;C:\\Program Files\\OpenSSL-Win64\\bin\\;C:\\Program Files (x86)\\Yarn\\bin\\;C:\\Program Files\\Microsoft VS Code Insiders\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\dotnet\\;C:\\Program Files\\PowerShell\\7\\;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\nodejs\\;C:\\Program Files\\Amazon\\AWSCLIV2\\;C:\\Program Files\\Amazon\\AWSSAMCLI\\bin\\;C:\\Program Files\\GitHub CLI\\;C:\\Users\\mySamAccountName\\AppData\\Roaming\\npm;C:\\Users\\mySamAccountName\\AppData\\Local\\Yarn\\bin;C:\\Users\\mySamAccountName\\AppData\\Local\\Microsoft\\WindowsApps;;C:\\Users\\mySamAccountName\\OneDrive - myOrganizationName\\Documents\\Scripting","CommonProgramW6432":"C:\\Program Files\\Common Files","PUBLIC":"C:\\Users\\Public","ProgramData":"C:\\ProgramData","LOGONSERVER":"\\\\aad-dc-zsc-p01"}
fda0bbe81247
>echo %TIME% - ExitCode: %ERRORLEVEL%
15:53:14.40 - ExitCode: 0
I also tried putting the pwsh.exe command in a shortcut and it runs the same speed as from the command prompt:
Thanks for your help, I really appreciate it. I've added some logging that might help us track down what's going on here. It'll be in our next build Monday, I'll ping this issue with instructions once that's out. Have a good weekend :)
The new Insiders build with more logging is available
It seems like the environment was echo'd successfully, but for some reason the terminal process didn't exit after doing so. I'm still not sure why, but we could be eager and resolve and close the shell process as soon as we see the complete environment data. That would also make this a little bit faster in all cases as a happy side effect.
This bug has been fixed in the latest release of VS Code Insiders!
@dbaileyut, you can help us out by commenting /verified if things are now working as expected.
If things still don't seem right, please ensure you're on version bdc1dd9a7c36b7dab7a9eeec2f05a19f7abd0409 of Insiders (today's or later - you can use Help: About in the command palette to check), and leave a comment letting us know what isn't working as expected.
Happy Coding!
Friendly ping! Looks like this issue requires some further steps to be verified. Please provide us with the steps necessary to verify this issue.
/verified
Just for the record, same issue here. It started happening after updating to:
Version: 1.101.2 Commit: 2901c5ac6db8a986a5666c3af51ff804d05af0d4 Date: 2025-06-24T20:27:15.391Z Electron: 35.5.1 ElectronBuildId: 11727614 Chromium: 134.0.6998.205 Node.js: 22.15.1 V8: 13.4.114.21-electron.0 OS: Windows_NT x64 10.0.19045