[BUG] SGR sequences leak into Windows terminal
Resolved 💬 5 comments Opened Apr 15, 2026 by caramdache Closed Apr 19, 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 run claude code on Debian through a Windows terminal. After I undock and redock the laptop, I get weird caracters popping up randomly in the terminal, like: ";1M35;24;;1M35;25;1M35;26;".
AFAIU, these are SGR mouse tracking escape sequences leaking into the terminal as raw text. The seems to be due to Claude Code not having the chance to shut down mouse tracking before the terminal geometry changed, and the terminal is then stuck in tracking mode.
What Should Happen?
Claude Could should exit more gracefully when ssh connection is lost.
Error Messages/Logs
;1M35;24;;1M35;25;1M35;26;
Steps to Reproduce
- Open Windows terminal, ssh to Debian host, run Claude Code
- Undock laptop without stopping Claude Code
- Redock, network connection is reset, Claude Code has stopped, terminal is left in SGR mode
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.109
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗