claude-code - 💡(How to fix) Fix Shell snapshot omits single-underscore functions, breaking scm_breeze (zsh)

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…

Claude Code's shell snapshot (~/.claude/shell-snapshots/snapshot-zsh-*.sh) captures some shell functions but skips others — specifically, it omits functions whose names start with a single underscore (e.g. _safe_eval) while preserving double-underscore ones (__git_alias, __zoxide_hook, etc.). The snapshot does, however, capture functions and aliases that reference the skipped ones, producing a broken shell where bare commands like git status fail with command not found: _safe_eval.

Error Message

Output (the command runs, but a follow-up error is appended):

Root Cause

This took a while to diagnose because the first command in a chain succeeds and prints its output normally; only later commands hit the missing function.

Fix Action

Workaround

For affected users: append the missing function definition to the current snapshot, or remove the offending plugin. Both are fragile — the snapshot regenerates.

🤖 Generated with Claude Code

Code Example

git status

---

exec_scmb_expand_args:3: command not found: _safe_eval

---

$ grep -c \"^exec_scmb_expand_args\" ~/.claude/shell-snapshots/snapshot-zsh-*.sh
1
$ grep -c \"^_safe_eval\" ~/.claude/shell-snapshots/snapshot-zsh-*.sh
0
$ grep \"_safe_eval\" ~/.claude/shell-snapshots/snapshot-zsh-*.sh
        _safe_eval \"\${args[@]}\"   # call, never defined
RAW_BUFFERClick to expand / collapse

Summary

Claude Code's shell snapshot (~/.claude/shell-snapshots/snapshot-zsh-*.sh) captures some shell functions but skips others — specifically, it omits functions whose names start with a single underscore (e.g. _safe_eval) while preserving double-underscore ones (__git_alias, __zoxide_hook, etc.). The snapshot does, however, capture functions and aliases that reference the skipped ones, producing a broken shell where bare commands like git status fail with command not found: _safe_eval.

Repro

Environment that triggered it for me:

  • macOS 26.4.1, zsh 5.9, Claude Code 2.1.144
  • zsh setup: prezto + zplug, with zplug \"scmbreeze/scm_breeze\" loaded in ~/.zprezto/runcoms/zshrc
  • scm_breeze aliases git to exec_scmb_expand_args git, and exec_scmb_expand_args internally calls _safe_eval

Inside a Claude Code session, run any git command via the Bash tool:

git status

Output (the command runs, but a follow-up error is appended):

exec_scmb_expand_args:3: command not found: _safe_eval

Inspecting the snapshot confirms the asymmetry:

$ grep -c \"^exec_scmb_expand_args\" ~/.claude/shell-snapshots/snapshot-zsh-*.sh
1
$ grep -c \"^_safe_eval\" ~/.claude/shell-snapshots/snapshot-zsh-*.sh
0
$ grep \"_safe_eval\" ~/.claude/shell-snapshots/snapshot-zsh-*.sh
        _safe_eval \"\${args[@]}\"   # call, never defined

Double-underscored functions from the same shell are in the snapshot (12 of them in mine: __git_alias, __zoxide_hook, etc.), so the filter appears to be specifically against _<letter> names, not all leading underscores.

Impact

Anything that wraps a common command (git, ls) and relies on single-underscored helpers will be broken inside Claude Code. The user-visible symptom is command not found errors appearing after seemingly successful tool calls, which silently swallows multi-command bash invocations (e.g. git add . && git commit -m \"...\" — the commit half is killed).

This took a while to diagnose because the first command in a chain succeeds and prints its output normally; only later commands hit the missing function.

Expected

The shell snapshot should either:

  1. Include all user-defined functions regardless of leading underscore, or
  2. Strip aliases/functions that reference names it doesn't define, so the resulting shell is internally consistent.

Workaround

For affected users: append the missing function definition to the current snapshot, or remove the offending plugin. Both are fragile — the snapshot regenerates.

🤖 Generated with Claude Code

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 omits single-underscore functions, breaking scm_breeze (zsh)