claude-code - 💡(How to fix) Fix Shell snapshot includes unresolvable zsh autoload stubs, breaking system commands (e.g. make, diff) [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#46856Fetched 2026-04-12 13:31:16
View on GitHub
Comments
0
Participants
1
Timeline
4
Reactions
0
Author
Participants
Timeline (top)
labeled ×4

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

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.

Code Example

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

---

make () {
    # undefined
    builtin autoload -XUz
}
RAW_BUFFERClick to expand / collapse

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.

extent analysis

TL;DR

Remove or replace zsh autoload stubs in the shell snapshot to prevent them from shadowing system binaries.

Guidance

  • Identify and exclude Prezto's utility module from the shell snapshot capture to prevent autoloaded zsh wrapper functions from being included.
  • Modify the snapshot capture process to strip or replace builtin autoload -XUz stubs with a passthrough to the real binary, ensuring system commands like make and diff are executed correctly.
  • Verify the affected commands, such as make, diff, async, compinit, and git-info, are working as expected after applying the changes.
  • Consider updating Prezto or adjusting the fpath in the subprocess environment to include the original function directories, although this may have unintended consequences.

Example

# Example of a stripped stub
make () {
  command /usr/bin/make "$@"
}

Note: This example assumes the command keyword is used to bypass the autoloaded function and execute the real binary.

Notes

The solution may require adjustments to the Claude Code shell snapshot capture process or the Prezto configuration. It is essential to test the changes thoroughly to ensure the expected behavior is achieved.

Recommendation

Apply a workaround to remove or replace zsh autoload stubs in the shell snapshot, as updating Prezto or modifying the subprocess environment may have unintended consequences or be impractical.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Shell snapshot includes unresolvable zsh autoload stubs, breaking system commands (e.g. make, diff) [1 participants]