Shell snapshot breaks zoxide cd wrapper - __zoxide_z not found
Resolved 💬 8 comments Opened Jan 23, 2026 by ryanschneider Closed Mar 8, 2026
Description
When using zoxide with the --cmd cd option (which replaces the cd command), Claude Code's shell snapshot captures the cd function wrapper but not the underlying __zoxide_z function, resulting in a broken cd command.
Environment
- macOS (Darwin 24.6.0)
- zsh
- zoxide installed via cargo
zoxide configuration
In ~/.zshrc:
eval "$(zoxide init --cmd cd zsh)"
This creates a cd function that wraps __zoxide_z:
cd () {
__zoxide_z "$@"
}
Observed behavior
When running cd ../ in Claude Code:
zsh: command not found: __zoxide_z
Investigation
type cdshows:cd is a shell function from /Users/.../.claude/shell-snapshots/snapshot-zsh-....shtype __zoxide_zshows:__zoxide_z not found- The snapshot file contains the
cdwrapper function but not the__zoxide_zfunction it depends on
Workaround
Using builtin cd bypasses the broken wrapper and works correctly.
Suggested fix
The shell snapshot logic should either:
- Capture all zoxide-related functions (
__zoxide_z,__zoxide_zi,__zoxide_hook, etc.) when it captures thecdwrapper - Not capture function-based
cdoverrides - Re-run
eval "$(zoxide init ...)"when loading the snapshot to regenerate the required functions - Detect and skip functions that reference undefined dependencies
This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗