VS Code cannot start zsh: Unable to resolve your shell environment (spawn ENOENT)
Unable to resolve your shell environment: A system error occurred (spawn /user/bin/zsh ENOENT)Short answer
ENOENT means the program VS Code tried to start does not exist at that path. For zsh it is either your account's login shell, which points to a missing file, or a terminal profile with a wrong path. Install zsh or point both at the real path, which command -v zsh prints.
Fix it fast
1Find out which cause you have
See which shell your account uses, and whether that file exists.
getent passwd "$USER" | cut -d: -f7 command -v zsh2Match what you see, then jump to its fix
- 1
The path in the error (for example /user/bin/zsh, with a typo) is the same as the last field of your passwd entry, and ls says it is missingThe login shell in your account points to a missing fileFix - 2
The wrong path appears in your settings.json, not in the passwd fileA VS Code terminal profile or default shell has a wrong pathFix
- 1
What does the error look like?
Unable to resolve your shell environment: A system error occurred (spawn /user/bin/zsh ENOENT)
Cause 1 of 2
The login shell in your account points to a missing file
1Check
chsh changes your login shell, and the shell must be listed in /etc/shells. Compare the account's shell with the zsh that is really installed.
ls -l "$(getent passwd "$USER" | cut -d: -f7)"
cat /etc/shells2Fix
Install zsh if needed (it is in the main section of Ubuntu 24.04), then set the login shell to the real path.
sudo apt install zsh
chsh -s "$(command -v zsh)"3Verify
Log out and in again, then check the new shell and start VS Code from the launcher.
getent passwd "$USER" | cut -d: -f7Confirmed by man7.org
Cause 2 of 2
A VS Code terminal profile or default shell has a wrong path
1Check
Terminal profiles are defined in terminal.integrated.profiles.linux with a path, and the default is chosen with terminal.integrated.defaultProfile.linux.
grep -n 'terminal.integrated' ~/.config/Code/User/settings.json2Fix
Correct the path of the profile to the one command -v zsh printed.
"terminal.integrated.profiles.linux": {
"zsh": { "path": "/usr/bin/zsh" }
},
"terminal.integrated.defaultProfile.linux": "zsh"3Verify
Open a new integrated terminal.
echo $SHELLConfirmed by code.visualstudio.com
How do I stop it coming back?
- Change your login shell with chsh, not by editing the passwd file by hand.
- Use the path printed by command -v zsh when you write a terminal profile.
- After moving a user between machines, check that the shell in the account exists there.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Related fixes
Servers
dnf cannot install MySQL on Amazon Linux 2023
dnf cannot find a mysql-server package on Amazon Linux 2023
Amazon Linux 2023 documents MariaDB, not MySQL, as its database server, with packages named mariadb105 and mariadb105-server.
3 causes, each with a fixServers
Ansible hangs, then times out waiting for the sudo prompt
a playbook using become seems to hang
Ansible ran sudo on the target and never saw the answer it expected.
3 causes, each with a fixServers
Apache on Ubuntu returns 404 Not Found for my site
The requested URL was not found on this server.
On Ubuntu a 404 from Apache usually means the request maps to a path that has no file.
3 causes, each with a fixServers
Apache returns 504 Gateway Timeout when PHP takes too long
Quick requests work, slow ones end in a 504 after a fixed wait
A 504 from Apache means the backend did not answer within the proxy timeout.
2 causes, each with a fixServers
Apache logs SIGWINCH and exits on its own
the httpd container stops although nothing crashed
SIGWINCH is Apache's graceful-stop signal.
2 causes, each with a fixServers
Apache warns that a ${VAR} config variable is not defined
${VAR} left unchanged in the configuration, with a warning in the error log
Apache expands ${VAR} from Define or from the shell environment that exists when the server starts.
3 causes, each with a fix