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.
client_loop: send disconnect: Broken pipeWrite failed: Broken pipepacket_write_wait: Connection to port 22: Broken pipeConnection reset by peer 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
Where this error sits
Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):
🧠 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.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 14 Oct 2026