claude-code - 💡(How to fix) Fix Shell snapshot missing GVM (_bash_pseudo_hash) dependencies causes setValueForKeyFakeAssocArray errors on cd [1 comments, 2 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#47792Fetched 2026-04-15 06:42:13
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×3commented ×1cross-referenced ×1

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.

Code Example

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

---

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

type _encode
# → shell function from ~/.gvm/scripts/function/_bash_pseudo_hash
RAW_BUFFERClick to expand / collapse

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.

extent analysis

TL;DR

Modify the Claude Code shell snapshot generation to include the dependencies of sourced functions, specifically the _encode and _decode functions from ~/.gvm/scripts/function/_bash_pseudo_hash.

Guidance

  • Identify the dependencies of the setValueForKeyFakeAssocArray function, including the _encode and _decode functions, and ensure they are included in the shell snapshot.
  • Verify that the ~/.gvm/scripts/function/_bash_pseudo_hash file is sourced in the shell snapshot by checking the snapshot file contents.
  • Consider modifying the Claude Code snapshot generation to fully re-source the user's shell init files, including GVM, before executing commands.
  • Test the modified snapshot generation by running the type commands provided in the verification section to ensure the dependencies are correctly captured.

Example

No code snippet is provided as the issue is related to the snapshot generation process, which is not explicitly described in code.

Notes

The solution may require modifications to the Claude Code shell snapshot generation process, which is not fully described in the issue. Additionally, the issue may be specific to the interaction between Claude Code and GVM, and may not be applicable to other shell configurations.

Recommendation

Apply a workaround by modifying the Claude Code shell snapshot generation to include the dependencies of sourced functions, as the root cause is related to the snapshot generation process and not a version-specific issue.

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…

FAQ

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.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING