Preflight Checklist
What's Wrong?
When Claude Code is launched from a shell where mise is activated (https://mise.jdx.dev/), every command that uses cd fails with:
bash: command not found: __zsh_like_cd
mise activate bash defines a helper function __zsh_like_cd() and wraps cd, pushd, and popd to call it (this is how mise detects directory changes to switch tool versions).
Claude Code's shell snapshot mechanism (~/.claude/shell-snapshots/snapshot-bash-*.sh) captures the cd(), pushd(), and popd() wrapper functions but does not capture __zsh_like_cd(). The snapshot also drops _mise_hook() and the chpwd_functions array.
It appears the snapshot logic filters out functions whose names start with __ (double underscore), but it keeps the functions that depend on them, leaving the shell in a broken state.
What Should Happen?
cd should work normally. The snapshot should either:
- Include all functions regardless of naming convention (including
__-prefixed ones), or
- Exclude functions that depend on other functions it filters out, or
- Not snapshot shell functions that wrap builtins like
cd/pushd/popd
Error Messages/Logs
bash: command not found: __zsh_like_cd
Steps to Reproduce
- Install
mise and add eval "$(mise activate bash)" to ~/.bashrc
- Open a terminal (so mise is activated)
- Launch
claude
- Run any command that uses
cd, e.g. ask Claude to run cd /tmp && ls
- Observe the
__zsh_like_cd: command not found error
Evidence from the snapshot file:
The snapshot contains the cd wrapper (base64-encoded):
eval "$(echo 'Y2QgKCkgCnsgCiAgICBfX3pzaF9saWtlX2NkIGNkICIkQCIKfQo=' | base64 -d)"
# Decodes to: cd () { __zsh_like_cd cd "$@" }
But __zsh_like_cd is completely absent from the snapshot file.
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
2.1.42
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
Workaround: Add this to the end of ~/.profile:
# Workaround: Claude Code's shell snapshot captures cd/pushd/popd
# wrappers from mise but drops __zsh_like_cd. Provide a minimal fallback.
if ! declare -f __zsh_like_cd >/dev/null 2>&1; then
__zsh_like_cd() { builtin "$@"; }
fi
This issue likely affects any tool that defines __-prefixed helper functions in bash (not just mise). The snapshot's function filtering is too aggressive - it breaks the dependency chain between captured and filtered functions.
Preflight Checklist
What's Wrong?
When Claude Code is launched from a shell where
miseis activated (https://mise.jdx.dev/), every command that usescdfails with:bash: command not found: __zsh_like_cdmise activate bashdefines a helper function__zsh_like_cd()and wrapscd,pushd, andpopdto call it (this is how mise detects directory changes to switch tool versions).Claude Code's shell snapshot mechanism (
~/.claude/shell-snapshots/snapshot-bash-*.sh) captures thecd(),pushd(), andpopd()wrapper functions but does not capture__zsh_like_cd(). The snapshot also drops_mise_hook()and thechpwd_functionsarray.It appears the snapshot logic filters out functions whose names start with
__(double underscore), but it keeps the functions that depend on them, leaving the shell in a broken state.What Should Happen?
cdshould work normally. The snapshot should either:__-prefixed ones), orcd/pushd/popdError Messages/Logs
bash: command not found: __zsh_like_cdSteps to Reproduce
miseand addeval "$(mise activate bash)"to~/.bashrcclaudecd, e.g. ask Claude to runcd /tmp && ls__zsh_like_cd: command not founderrorEvidence from the snapshot file:
The snapshot contains the
cdwrapper (base64-encoded):But
__zsh_like_cdis completely absent from the snapshot file.Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
No response
Claude Code Version
2.1.42
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
Other
Additional Information
Workaround: Add this to the end of
~/.profile:This issue likely affects any tool that defines
__-prefixed helper functions in bash (not justmise). The snapshot's function filtering is too aggressive - it breaks the dependency chain between captured and filtered functions.