[BUG] Shell snapshots filter out __ (double underscore) prefixed functions, breaking dependent functions

Resolved 💬 3 comments Opened Feb 4, 2026 by franciszekza Closed Mar 6, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

I have a lazy-loading setup in my .zshrc file like this:

__load_nvm() {
  unset -f nvm 2>/dev/null
  [[ -s "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
}
nvm() { __load_nvm; nvm "$@"; }

(Simplified example).

This breaks using nvm in claude - leading to errors like command not found: __load_nvm.

What Should Happen?

Snapshots should not filter out those functions - or this behaviour should be documented.

Error Messages/Logs

Steps to Reproduce

  1. Define in .zshrc
__load_nvm() {
  unset -f nvm 2>/dev/null
  [[ -s "$NVM_DIR/nvm.sh" ]] && source "$NVM_DIR/nvm.sh"
}
nvm() { __load_nvm; nvm "$@"; }
  1. Delete ~/.claude/shell-snapshots/*
  2. Start Claude Code and ask it to run any nvm command
  3. 4. Error: command not found: __load_nvm

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.31 (Claude Code)

Platform

AWS Bedrock

Operating System

macOS

Terminal/Shell

iTerm2

Additional Information

The lazy-loading setup defined like this was generated by claude itself.

View original on GitHub ↗

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