-
Notifications
You must be signed in to change notification settings - Fork 6.9k
Description
Preflight Checklist
- I have searched existing issues and this hasn't been reported yet
- This is a single bug report (please file separate reports for different bugs)
- I am using the latest version of Claude Code
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_cdmise 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_cdSteps to Reproduce
- Install
miseand addeval "$(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 runcd /tmp && ls - Observe the
__zsh_like_cd: command not founderror
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 "$@"; }
fiThis 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.