[BUG] CLI CloudeCode Chat silenty CORRUPT pasted text.
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?
Large text blocks pasted into Claude Code have $' silently stripped before escape sequences like $'\t', but only intermittently and only in larger pastes. This is a data integrity issue with no user-visible warning.
What Should Happen?
The Chat Interface should NEVER discard anything. This is very serious bugs, I can no longer trust the integrity of any text I'm pasting.
Error Messages/Logs
None.
Steps to Reproduce
I'm pasting the following code snippet in the CLI Chat interface:
sudo \
bash -o pipefail -O inherit_errexit -euxc "$(cat - 0<<'cmdEOF'
: '--- Cleaning Package Manager. ---'
dnf -y remove $(dnf5 repoquery --installonly --latest-limit=-1 -q) || true
dnf -y autoremove
dnf clean all
: '--- Removing `cloud-init` cache to force new instance to re-run it. ---'
rm -rf /var/lib/cloud/*
echo 'localhost' > /etc/hostname
: '--- Removing SSH Host Keys. ---'
rm -f /etc/ssh/ssh_host_*_key
rm -f /etc/ssh/ssh_host_*_key.pub
: '--- Removing Root and Default User SSH directory. ---'
rm -rf /root/.ssh/
rm -rf "$(getent passwd 1000 | cut -d: -f6)/.ssh/"
: '--- Removing non-Default Users. ---'
awk -F: '(($3 >= 1001) && ($1 != "nobody")){print $1}' /etc/passwd | \
xargs -r userdel -r
: '--- Removing non-Default Groups. ---'
awk -F: '(($3 >= 1001) && ($1 != "nobody")){print $1}' /etc/group | \
xargs -r groupdel
: '--- Removing Default User & Group. ---'
chown -R 1001:1001 {/home,/var/spool/mail}/"$(id -nu 1000)"
sed -E -i 's/^(([^:]*:){2})1000:1000:/\11001:1001:/' /etc/passwd
sed -E -i 's/^(([^:]*:){2})1000:/\11001:/' /etc/group
userdel -r "$(id -nu 1001)"
: '--- Clearing `machine-id` for unique Instance Identity. ---'
truncate -s 0 /etc/machine-id
rm -f /var/lib/dbus/machine-id
: '--- Removing Random Seed. ---'
rm -f /var/lib/systemd/random-seed
: '--- Removing Temporary Files. ---'
rm -rf /tmp/*
rm -rf /var/tmp/*
: '--- Cleaning up Log Files. ---'
find /var/log -type f \( \
-name '*.log.*' -o \
-name '*.gz' -o \
-name '*.bz2' -o \
-name '*.xz' \
\) -delete
find /var/log -type f -name '*.log' -exec truncate -s 0 '{}' \;
: '--- Turning off Swap. ---'
swapoff -a || true
: '--- Zeroing Swap Partitions. ---'
(
# Zero only Disk-based Swap Partitions (skip RAM-based swap).
for sd in $(
blkid -t TYPE=swap -o device |
grep -vE '/dev/(zram|loop)'
); do
echo "Zeroing Swap Partition ${sd@Q}..."
dd if=/dev/zero of="${sd}" bs=1M status=progress || true
done
)
: '--- Zeroing Volumes. ---'
(
# Get only Block Dev. Mount Points (excluding tmpfs, devtmpfs, etc.).
while IFS= read -r mp; do
echo "Zeroing free space on ${mp@Q}..."
touch "${mp}/zerofile"
chattr +C "${mp}/zerofile" 2> /dev/null || true
dd if=/dev/zero of="${mp}/zerofile" bs=1M conv=fsync status=progress || true
rm -f "${mp}/zerofile"
done 0< <(
# FS without sub-vol.
df -t ext4 -t xfs -t vfat --output=target |
tail -n +2
# B-Tree FS: pick the least quota-restricted sub-vol. per dev.
df -t btrfs --output=source,avail,target |
tail -n +2 |
sed -E 's/ */\t/; s/ */\t/' |
sort -t $'\t' -k 1,1 -k 2,2rn |
awk -F '\t' '!seen[$1]++ {print $3}'
)
)
: '--- Cleaning up `systemd journal` Logs. ---'
journalctl --rotate
journalctl --vacuum-time=1s
: '--- Cleanup complete. Shutting down. ---'
shutdown now
cmdEOF
)"; echo $?
The line: sort -t $'\t' -k 1,1 -k 2,2rn got corrupted to sort -t \t' -k 1,1 -k 2,2rn, it silently discard $' in front of \t. ONLY occurs if I copy and paste the whole block. Smaller block or just that line works.
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.38 (Claude Code)
Platform
Google Vertex AI
Operating System
Other Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗