You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WSL2 - Microsoft VS Code/Code.exe: Exec format error #40537
on a distro, then, if you switch distro, you get the error
grufoony@Gregorio:~$ code .
/mnt/c/Users/Gregorio/AppData/Local/Programs/Microsoft VS Code/bin/code: 62: /mnt/c/Users/Gregorio/AppData/Local/Programs/Microsoft VS Code/Code.exe: Exec format error
I noticed that if you do not call code on the other distro or you:
If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.
How to collect WSL logs
Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
The script will output the path of the log file once done.
If this is a networking issue, please use .\collect-wsl-logs.ps1 -LogProfile networking instead, following the instructions in Collect WSL logs for networking issues
Once completed please upload the output files to this GitHub issue.
If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.
The log file doesn't contain any WSL traces. Please make sure that you reproduced the issue while the log collection was running.
Diagnostic information
Issue was edited and new log file was found: https://github.com/user-attachments/files/27750937/WslLogs-2026-05-14_10-27-14.tar.gz
.wslconfig found
Detected appx version: 2.6.3.0
Found no WSL traces in the logs
It has been a week since I have both distro installed and I'm dealing with this issue every day when I start the PC... once fixed it seems to be good until the next reboot
Tracked this down. WSLInterop lives in binfmt_misc, which is kernel-global across the whole WSL2 VM, so all your distros share one registry. When a systemd distro shuts down cleanly, systemd-shutdown runs disable_binfmt(), which wipes every entry including WSLInterop for all running distros. That's why running code in a second distro breaks the first, and why a reboot fixes it until the next time.
It was introduced by clean systemd termination (#13552) and is fixed by #40621, which will be in an upcoming release.
Activity
github-actions commentedon May 14, 2026
Logs are required for review from WSL team
If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.
How to collect WSL logs
Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
The script will output the path of the log file once done.
If this is a networking issue, please use
.\collect-wsl-logs.ps1 -LogProfile networkinginstead, following the instructions in Collect WSL logs for networking issuesOnce completed please upload the output files to this GitHub issue.
See Collect WSL logs (recommended method).
If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.
github-actions commentedon May 14, 2026
The log file doesn't contain any WSL traces. Please make sure that you reproduced the issue while the log collection was running.
Diagnostic information
benhillis commentedon May 14, 2026
I've seen a few reports of this, but I haven't been able to determine a repro. Do you have repeatable steps to get into this state?
Grufoony commentedon May 14, 2026
The only way I was able to reproduce this is:
code .command (it should work)code .command -> now it should be brokenIt has been a week since I have both distro installed and I'm dealing with this issue every day when I start the PC... once fixed it seems to be good until the next reboot
gorgsenegger commentedon May 18, 2026
I get exactly the same error on Windows 11, WSL version 2.7.3.0 after installing Ubuntu 26.04 in addition to 22.04.
benhillis commentedon May 29, 2026
Tracked this down.
WSLInteroplives inbinfmt_misc, which is kernel-global across the whole WSL2 VM, so all your distros share one registry. When a systemd distro shuts down cleanly,systemd-shutdownrunsdisable_binfmt(), which wipes every entry includingWSLInteropfor all running distros. That's why runningcodein a second distro breaks the first, and why a reboot fixes it until the next time.It was introduced by clean systemd termination (#13552) and is fixed by #40621, which will be in an upcoming release.
kenden commentedon Jun 8, 2026
Until the next version with the fix is released, the workaround described here seems to help:
chemwolf6922 commentedon Jun 30, 2026
Fixed in 2.9.3 (pre-release)