Unexpected shell validation failure despite valid $SHELL setting
Status Fixed / completed
Maintainer reply ✓ Yes — wolffiex
Activity 8 comments · opened Mar 12, 2025 · closed Mar 14, 2025
💡 Likely answer: A maintainer (wolffiex, collaborator)
responded on this thread — see the highlighted reply below.
Bug Description
claude complains about not having a valid shell, but $SHELL is set to a working zsh
Environment Info
- Platform: linux
- Terminal: tmux
- Version: 0.2.30
- Feedback ID: 11050e7c-6baa-4cbb-98f2-3ef0532d26d8
❯ echo $SHELL
/nix/store/m7l6yzmflrf9hjs8707lk9nkhi6f73n1-zsh-5.9/bin/zsh
❯ claude
╭────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code research preview! │
│ │
│ /help for help │
│ │
│ cwd: /home/pbozeman/src/svc-example │
╰────────────────────────────────────────────╯
╭───────────────────────────────────────────────────────────────────────────────────────╮
│ > │
╰───────────────────────────────────────────────────────────────────────────────────────╯
! for bash mode · / for commands · esc to undo \⏎ for newline
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: No suitable shell found. Claude CLI requires a Posix shell environment. Please ensure you have a valid shell installed and the SHELL environment variable set.
at i6.findSuitableShell (file:///nix/store/g2i9z5sij5gsgcly3fcsh9vw20q5ybk2-claude-code-0.2.30/lib/node_modules/@anthropic-ai/claude-code/cli.mjs:339:8036)
at new i6 (file:///nix/store/g2i9z5sij5gsgcly3fcsh9vw20q5ybk2-claude-code-0.2.30/lib/node_modules/@anthropic-ai/claude-code/cli.mjs:339:5985)
at i6.getInstance (file:///nix/store/g2i9z5sij5gsgcly3fcsh9vw20q5ybk2-claude-code-0.2.30/lib/node_modules/@anthropic-ai/claude-code/cli.mjs:339:8426)
at mw (file:///nix/store/g2i9z5sij5gsgcly3fcsh9vw20q5ybk2-claude-code-0.2.30/lib/node_modules/@anthropic-ai/claude-code/cli.mjs:344:1172)
at aH (file:///nix/store/g2i9z5sij5gsgcly3fcsh9vw20q5ybk2-claude-code-0.2.30/lib/node_modules/@anthropic-ai/claude-code/cli.mjs:1162:14518)
at cz1.<anonymous> (file:///nix/store/g2i9z5sij5gsgcly3fcsh9vw20q5ybk2-claude-code-0.
8 Comments
thanks for this report. is
/nix/store/m7l6yzmflrf9hjs8707lk9nkhi6f73n1-zsh-5.9/bin/zshan executable file?Yes, I can exec $SHELL.
And just for good measure:
got it, I think nix does some tricky stuff with the executable bit. I should have a fix for this out tomorrow
ok, I added some special logic for this. v0.2.40 is rolling now. can you please re-test and let me know if this is fixed?
Since this is on nix, it will be far easiest if can just override the nix package and point it at an updated repo and hash. At the time I'm writing this comment, it doesn't look like any of the branches on https://github.com/anthropics/claude-code have 0.2.40, or at least, I can't find it. Is the fix up on a public repo somewhere?
This repo is for bug tracking only. The official package is here: https://www.npmjs.com/package/@anthropic-ai/claude-code
You can check your version with
claude --versionand force update withclaude updateWe don't support claude updating on nix yet
The fix works. Thanks.
For anyone else reading this in the future, but before the claud-code has been updated in nixpackages, you can use an overlay to update. To upgrade to other versions, just update the version below, run update, and update to the new hash after it gives it to you after an initial mismatch.
./overlays/claude-code.nix (or wherever you personally put them):
./overlays/default.nix:
and in your flake:
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.