Shell snapshot missing GVM (_bash_pseudo_hash) dependencies causes setValueForKeyFakeAssocArray errors on cd

Resolved 💬 3 comments Opened Apr 14, 2026 by pawel-slusarczyk Closed Apr 17, 2026

Bug description

When navigating directories (cd) in Claude Code's shell context, the following errors appear:

setValueForKeyFakeAssocArray:27: command not found: _encode
setValueForKeyFakeAssocArray:27: command not found: _encode
valueForKeyFakeAssocArray:28: command not found: _decode
valueForKeyFakeAssocArray:28: command not found: _decode

Root cause

Claude Code creates shell snapshots (in ~/.claude/shell-snapshots/) that capture shell functions including setValueForKeyFakeAssocArray from GVM (Go Version Manager). However, the snapshot does not source the file that defines _encode and _decode (~/.gvm/scripts/function/_bash_pseudo_hash), which setValueForKeyFakeAssocArray depends on.

The chpwd hook fires on each cd, calling the function with missing dependencies.

Environment

  • Shell: zsh
  • GVM installed at ~/.gvm
  • .zshrc contains: [[ -s "/Users/.../.gvm/scripts/gvm" ]] && source "/Users/.../.gvm/scripts/gvm"
  • Claude Code snapshot path: ~/.claude/shell-snapshots/snapshot-zsh-*.sh

Verification

type setValueForKeyFakeAssocArray
# → shell function from ~/.claude/shell-snapshots/snapshot-zsh-*.sh

type _encode
# → shell function from ~/.gvm/scripts/function/_bash_pseudo_hash

The snapshot captures setValueForKeyFakeAssocArray but not its dependencies.

Expected behavior

Shell snapshots should either capture all transitive dependencies of sourced functions, or fully re-source the user's shell init files (including GVM) before executing commands.

View original on GitHub ↗

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