zed
zed copied to clipboard
Got an Error in startup after setting up another shell in system by default
Check for existing issues
- [X] Completed
Describe the bug / provide steps to reproduce it
Steps tested on macOS
- Install nushell using brew.
- Configure (PATH as minimum)
- Set it up as default shell in system for current user and relogin.
- Opening Zed got an error in the bottom panel:
Login shell exited with nonzero exit code. See log... - Error in logs:
[ERROR] login shell exited with exit status: 1 - Problem in Zed: terminal opens in home directory instead of project directory.
Environment
Zed: v0.160.7 (Zed) OS: macOS 15.1.0 Memory: 16 GiB Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
If applicable, attach your Zed.log file to this issue.
Zed.log
2024-11-07T00:35:32.377729+03:00 [INFO] ========== starting zed ==========
2024-11-07T00:35:32.380289+03:00 [INFO] Opening main db
2024-11-07T00:35:32.381709+03:00 [INFO] Opening main db
2024-11-07T00:35:32.39858+03:00 [INFO] Using git binary path: Some("/Applications/Zed.app/Contents/MacOS/git")
2024-11-07T00:35:32.46985+03:00 [INFO] set environment variables from shell:/opt/homebrew/bin/nu, path:/usr/bin:/bin:/usr/sbin:/sbin:/opt/homebrew/bin:/Users/danisvaliev001/.cargo/bin:/Users/danisvaliev001/00-main/03-resources/golang/bin
2024-11-07T00:35:32.63728+03:00 [INFO] no tokio runtime found, creating one for Reqwest...
2024-11-07T00:35:32.658113+03:00 [INFO] initializing context server client
2024-11-07T00:35:32.658228+03:00 [INFO] Registering built-in prompt template: content_prompt
2024-11-07T00:35:32.658543+03:00 [INFO] Registering built-in prompt template: edit_workflow
2024-11-07T00:35:32.658684+03:00 [INFO] Registering built-in prompt template: project_slash_command
2024-11-07T00:35:32.658755+03:00 [INFO] Registering built-in prompt template: terminal_assistant_prompt
2024-11-07T00:35:32.658924+03:00 [INFO] No prompt template overrides directory found at /Users/danisvaliev001/.config/zed/prompt_overrides. Using built-in prompts.
2024-11-07T00:35:32.659489+03:00 [INFO] extensions updated. loading 3, reloading 0, unloading 0
2024-11-07T00:35:32.672447+03:00 [INFO] Opening main db
2024-11-07T00:35:32.744458+03:00 [INFO] Opening main db
2024-11-07T00:35:32.747048+03:00 [INFO] set status on client 0: Authenticating
2024-11-07T00:35:32.7537+03:00 [INFO] open paths ["/Users/danisvaliev001/.config/zed/settings.json"]
2024-11-07T00:35:32.753815+03:00 [INFO] open paths ["/Users/danisvaliev001/.config/zed/tasks.json"]
2024-11-07T00:35:32.75389+03:00 [INFO] open paths ["/Users/danisvaliev001/.zshrc"]
2024-11-07T00:35:32.788659+03:00 [INFO] Opening main db
2024-11-07T00:35:32.80064+03:00 [INFO] set status on client 75274: Connecting
2024-11-07T00:35:32.81687+03:00 [INFO] attempting to start language server "json-language-server", path: "/Users/danisvaliev001/.config/zed/tasks.json", id: 1
2024-11-07T00:35:32.816996+03:00 [INFO] Initializing default prettier with plugins {}
2024-11-07T00:35:32.818222+03:00 [INFO] attempting to start language server "json-language-server", path: "/Users/danisvaliev001/.config/zed/settings.json", id: 2
2024-11-07T00:35:32.818331+03:00 [INFO] Initializing default prettier with plugins {}
2024-11-07T00:35:32.818491+03:00 [INFO] Initializing default prettier with plugins {}
2024-11-07T00:35:32.818563+03:00 [INFO] Initializing default prettier with plugins {}
2024-11-07T00:35:32.820536+03:00 [INFO] fetching latest version of language server "json-language-server"
2024-11-07T00:35:32.820676+03:00 [INFO] Node runtime install_if_needed
2024-11-07T00:35:32.825641+03:00 [INFO] attempting to start language server "gopls", path: "/Users/danisvaliev001/00-main/01-projects/stepik-go-datastructures", id: 3
2024-11-07T00:35:32.825859+03:00 [INFO] Initializing default prettier with plugins {}
2024-11-07T00:35:32.825944+03:00 [INFO] Initializing default prettier with plugins {}
2024-11-07T00:35:32.830194+03:00 [INFO] Initializing default prettier with plugins {}
2024-11-07T00:35:32.8303+03:00 [INFO] Initializing default prettier with plugins {}
2024-11-07T00:35:32.833663+03:00 [INFO] Initializing default prettier with plugins {}
2024-11-07T00:35:32.833761+03:00 [INFO] Initializing default prettier with plugins {}
2024-11-07T00:35:32.885288+03:00 [ERROR] login shell exited with exit status: 1
2024-11-07T00:35:32.925743+03:00 [INFO] fetching latest version of language server "gopls"
2024-11-07T00:35:32.940591+03:00 [INFO] Initializing default prettier with plugins {}
2024-11-07T00:35:32.940688+03:00 [INFO] Initializing default prettier with plugins {}
2024-11-07T00:35:33.244075+03:00 [INFO] connected to rpc endpoint https://collab.zed.dev/rpc
2024-11-07T00:35:33.399516+03:00 [INFO] downloading language server "gopls"
2024-11-07T00:35:33.399773+03:00 [INFO] using project environment for language server LanguageServerName("gopls")
2024-11-07T00:35:33.399892+03:00 [INFO] starting language server process. binary path: "/Users/danisvaliev001/Library/Application Support/Zed/languages/gopls/gopls_0.16.2", working directory: "/Users/danisvaliev001/00-main/01-projects/stepik-go-datastructures", args: ["-mode=stdio"]
2024-11-07T00:35:33.402221+03:00 [INFO] Node runtime install_if_needed
2024-11-07T00:35:33.510728+03:00 [INFO] starting language server process. binary path: "/Users/danisvaliev001/Library/Application Support/Zed/node/node-v22.5.1-darwin-arm64/bin/node", working directory: "/", args: ["/Users/danisvaliev001/Library/Application Support/Zed/copilot/copilot-v0.5.0/dist/agent.js", "--stdio"]
2024-11-07T00:35:33.631093+03:00 [INFO] downloading language server "json-language-server"
2024-11-07T00:35:33.631451+03:00 [INFO] Node runtime install_if_needed
2024-11-07T00:35:33.711675+03:00 [WARN] unhandled capability registration: Registration { id: "workspace/didChangeConfiguration", method: "workspace/didChangeConfiguration", register_options: None }
2024-11-07T00:35:33.756872+03:00 [INFO] Node runtime install_if_needed
2024-11-07T00:35:33.818392+03:00 [INFO] Language server with id 0 sent unhandled notification LogMessage:
{
"level": 0,
"message": "[DEBUG] [agent] [2024-11-06T21:35:33.814Z] Agent service starting",
"metadataStr": "[DEBUG] [agent] [2024-11-06T21:35:33.814Z]",
"extra": [
"Agent service starting"
]
}
2024-11-07T00:35:33.820879+03:00 [INFO] Language server with id 0 sent unhandled notification client/registerCapability:
{
"registrations": [
{
"id": "4717e826-0269-45cc-a621-b7678817fd9d",
"method": "workspace/didChangeWorkspaceFolders",
"registerOptions": {}
}
]
}
2024-11-07T00:35:33.858575+03:00 [INFO] using project environment for language server LanguageServerName("json-language-server")
2024-11-07T00:35:33.858657+03:00 [INFO] using project environment for language server LanguageServerName("json-language-server")
2024-11-07T00:35:33.85871+03:00 [INFO] starting language server process. binary path: "/Users/danisvaliev001/Library/Application Support/Zed/node/node-v22.5.1-darwin-arm64/bin/node", working directory: "/Users/danisvaliev001/.config/zed", args: ["/Users/danisvaliev001/Library/Application Support/Zed/languages/json-language-server/node_modules/vscode-langservers-extracted/bin/vscode-json-language-server", "--stdio"]
2024-11-07T00:35:33.859016+03:00 [INFO] starting language server process. binary path: "/Users/danisvaliev001/Library/Application Support/Zed/node/node-v22.5.1-darwin-arm64/bin/node", working directory: "/Users/danisvaliev001/.config/zed", args: ["/Users/danisvaliev001/Library/Application Support/Zed/languages/json-language-server/node_modules/vscode-langservers-extracted/bin/vscode-json-language-server", "--stdio"]
2024-11-07T00:35:34.074372+03:00 [INFO] add connection to peer
2024-11-07T00:35:34.074446+03:00 [INFO] add_connection;
2024-11-07T00:35:34.07449+03:00 [INFO] waiting for server hello
2024-11-07T00:35:34.074665+03:00 [INFO] got server hello
2024-11-07T00:35:34.074722+03:00 [INFO] set status to connected (connection id: ConnectionId { owner_id: 0, id: 0 }, peer id: PeerId { owner_id: 606, id: 5592074 })
2024-11-07T00:35:34.074797+03:00 [INFO] set status on client 75274: Connected { peer_id: PeerId { owner_id: 606, id: 5592074 }, connection_id: ConnectionId { owner_id: 0, id: 0 } }
2024-11-07T00:35:34.383464+03:00 [INFO] Language server with id 0 sent unhandled notification LogMessage:
{
"level": 0,
"message": "[DEBUG] [agent] [2024-11-06T21:35:34.375Z] Telemetry initialized",
"metadataStr": "[DEBUG] [agent] [2024-11-06T21:35:34.375Z]",
"extra": [
"Telemetry initialized"
]
}
Tried to add the next configuration, does not help:
"terminal": {
"shell": {
"with_arguments": {
"program": "/opt/homebrew/bin/nu",
"args": ["--login"]
}
}
UPD: Sometimes there is no error at startup.
UPD 2: And terminal opens in the right directory in those times.
It's probably the load_login_shell_environment function. Wether or not the error happens probably depends on your current environment variables.
I would probably throw the whole function away. It's really cursed. SHELL doesn't have to have the used arguments.
But as it's probably useful, I think it would be best to be able to hide the error. It's pretty annoying.
I am not observing this error after the last major updates.
I added additional logging to https://github.com/zed-industries/zed/blob/8fe134e3619b6852b45faffded94214a526df54d/crates/project/src/environment.rs#L300 to log the shell command / args + stdout/stderr. It became apparent after seeing what the stderr message was:
2025-05-13T22:34:01+09:00 ERROR [project::environment] login shell exited with exit status: 1
2025-05-13T22:34:01+09:00 ERROR [project::environment] shell stdout: "", stderr: "Error: × Nushell launched as a REPL, but STDIN is not a TTY; either launch in a\n │ valid terminal or provide arguments to invoke a script!\n\n"
In my zsh login script I was unconditionally launching nushell. The fix for me was:
if [[ $- == *i* ]]; then
exec nu --login
fi
This honestly wouldn't have really been resolved for me without stdout/stderr and the shell command. Trying to launch the shell command on its own from a command prompt didn't print the error seen here (because stdin was a TTY) or have a non-zero status code, but it confirmed that the expected shell was being launched.
I would recommend adding stdout to output logging as it will make self-resolution more possible without having to do a custom build.
Hi there! 👋 We're working to clean up our issue tracker by closing older issues that might not be relevant anymore. If you are able to reproduce this issue in the latest version of Zed, please let us know by commenting on this issue, and we will keep it open. If you can't reproduce it, feel free to close the issue yourself. Otherwise, we'll close it in 7 days. Thanks for your help!
This issue was closed due to inactivity. If you're still experiencing this problem, please open a new issue with a link to this issue.