Shell snapshot includes unresolvable zsh autoload stubs, breaking system commands (e.g. make, diff)

Resolved 💬 2 comments Opened Apr 12, 2026 by nbellowe Closed May 23, 2026

Summary

When Claude Code captures a shell snapshot to run Bash tool commands, it includes zsh autoload stubs (functions defined as builtin autoload -XUz) that shadow system binaries. These stubs cannot resolve in the subprocess environment because it doesn't have the original fpath, causing commands like make and diff to fail with:

(eval):1: make: function definition file not found

Environment

  • macOS (Darwin 24.5.0)
  • zsh with Prezto framework

Root Cause

Prezto's utility module registers system commands like make and diff as autoloaded zsh wrapper functions (for colorization, etc.). When Claude Code captures the shell snapshot via typeset -f or equivalent, these appear as:

make () {
    # undefined
    builtin autoload -XUz
}

When Claude Code sources the snapshot in a subprocess to execute Bash tool commands, these stubs shadow /usr/bin/make, /usr/bin/diff, etc. The builtin autoload -XUz call then fails because the subprocess does not have the Prezto function directories in fpath.

Evidence

Old snapshots (pre-updprezto, ~1.2K) had zero undefined stubs. New snapshots (~49K) contain 83 such stubs, including make, diff, and many Prezto git/utility helpers.

Affected commands include: make, diff, async, compinit, git-info, and ~78 others.

Expected Behavior

Claude Code's shell snapshot should not include builtin autoload -XUz stubs, since they are unresolvable outside the original interactive shell environment. These stubs should either be stripped from the snapshot or replaced with a passthrough to the real binary.

View original on GitHub ↗

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