[BUG] Bash tool fails with zsh + zoxide configuration - "__zoxide_z not found" errors

Resolved 💬 9 comments Opened Jun 26, 2025 by mrwilby Closed Aug 22, 2025

Description

The Bash tool in Claude Code consistently fails when executing commands that involve directory navigation on systems with zsh configured with zoxide (a modern cd replacement).

## Environment

  • OS: macOS (Darwin 24.5.0)
  • Shell: zsh with zoxide configured
  • Claude Code Version: 1.0.35
  • Terminal: Various (tested in multiple terminals)

## Error Details

When Claude attempts to execute bash commands that involve directory changes, it produces:

```bash
z:1: command not found: __zoxide_z

This error occurs even when using explicit command patterns like:

  • cd system/admin-proxy && ../../sync --dry-run download
  • /bin/zsh -c "cd system/admin-proxy && pwd && ../../sync --dry-run download"

Expected Behavior

Bash tool should be able to execute shell commands normally, regardless of user's shell configuration (zoxide, starship, etc.).

Actual Behavior

Commands fail with zoxide-related errors, requiring workarounds using absolute paths instead of relative navigation.

Reproduction Steps

  1. Configure zsh with zoxide (common modern shell setup)
  2. Use Claude Code's Bash tool to execute any command involving directory navigation
  3. Observe the "__zoxide_z not found" error

Workaround

Using absolute paths instead of relative paths:

# Fails:
cd some/directory && command

# Works:
/absolute/path/to/command

Impact

This affects users with modern shell configurations (zoxide is very popular in the developer community). It forces Claude to use less efficient
absolute path workarounds and degrades the user experience.

Suggested Investigation

The issue appears to be that the Bash tool doesn't properly inherit or handle custom shell configurations/hooks that modify the shell environment. It
may be executing commands in a clean environment that lacks user-configured shell enhancements.

Additional Context

  • This issue was encountered during a complex development session involving CLI tool refactoring
  • The error is consistent and reproducible across different command patterns
  • Absolute path workarounds are functional but less elegant and harder for Claude to reason about

View original on GitHub ↗

This issue has 9 comments on GitHub. Read the full discussion on GitHub ↗