client_loop: send disconnect: Broken pipe (SSH session drops when idle)
The SSH connection was cut — usually an idle timeout on a NAT router, firewall or the server, sometimes a network change.
Seen on:
Linux
Meaning
NAT devices and firewalls drop idle TCP connections. Without keep-alives, the next keystroke finds the connection gone. Laptops sleeping or switching Wi-Fi cause the same.
Common causes
- Idle connection dropped by NAT/firewall
- Server ClientAliveInterval disconnects idle clients
- Network change or laptop sleep
- Server restarted/sshd killed
⚡ Quick fix
- Enable keep-alives: ServerAliveInterval 60 in ~/.ssh/config
- Use tmux/screen so work survives disconnects
- Consider mosh on unreliable networks
Detailed fix by platform
Shell
- bash
# ~/.ssh/config Host * ServerAliveInterval 60 ServerAliveCountMax 3
How to diagnose
- Timing — After how long idle?
- Network — Wi-Fi/VPN changes?
- Server — ClientAliveInterval in sshd_config
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Linux
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026