Shell snapshot corruption on Windows (Git Bash/MSYS2) - pipe buffer truncation

Resolved 💬 3 comments Opened Feb 24, 2026 by hslee-cmyk Closed Feb 27, 2026

Description

Shell snapshots under ~/.claude/shell-snapshots/ are consistently corrupted on Windows when using Git Bash (MSYS2). The snapshot file that captures shell state (aliases, set options, shopt options) suffers from pipe buffer truncation, causing partial lines and missing data.

Every Bash tool invocation produces errors from the corrupted snapshot:

line 3: or: command not found
line 5: heckhash: command not found

Corrupted snapshot content

# Line 1-2: OK
alias -- ll='ls -l'
alias -- ls='ls -F --color=auto --show-control-chars'
# Line 3: TRUNCATED — should be "set +o monitor" or similar, only "or" remains
or
# Line 4: OK
set -o onecmd
# Line 5: TRUNCATED — should be "shopt -u checkhash", prefix "shopt -u c" lost
heckhash
# Line 6+: OK
shopt -u checkjobs
shopt -s checkwinsize
...

Analysis

  • All set +o / set -o lines between aliases and set -o onecmd are completely missing (dozens of lines lost)
  • Truncation occurs at byte boundaries, not line boundaries — mid-line cuts leave fragments like or and heckhash
  • This is not an encoding issue — all corrupted characters are ASCII
  • Pattern is consistent with pipe buffer misalignment during shell state capture

Expected behavior

The snapshot should contain the complete output of alias, set +o, and shopt -p without any data loss.

Environment

  • OS: Windows 11 Home 10.0.26200 (Korean locale)
  • Shell: Git Bash (MSYS2) — /usr/bin/bash
  • Claude Code: CLI (latest)
  • Bash version: GNU bash, via MSYS2/mintty

Reproduction

  1. Run Claude Code on Windows with Git Bash as the shell
  2. Execute any Bash tool command
  3. Observe error messages from the corrupted snapshot on every command execution

Impact

  • Every Bash tool call prints command not found errors for the truncated lines
  • Low functional impact (aliases and shopt defaults are mostly preserved), but noisy and indicates potential data integrity issues in other pipe-based operations

View original on GitHub ↗

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