Azure Pipelines "agent lost communication with the server"
The server stopped receiving heartbeats from the agent while a job was running and abandoned the job. The agent host rebooted, lost network, ran out of memory, or had its process killed.
What this error means
A running job fails with ##[error]The agent X lost communication with the server or We stopped hearing from agent X and the job is abandoned mid-step.
##[error]We stopped hearing from agent 'self-host-01'. Verify the agent machine is
running and has a healthy network connection.Common causes
The agent host rebooted or lost network
A restart, a dropped connection, or a flaky link severs the heartbeat, so the server gives up on the job.
Resource exhaustion killed the agent
Out-of-memory or disk pressure on the host can kill the agent process, ending its communication abruptly.
How to fix it
Verify host health and connectivity
- Confirm the agent machine is running and the agent service is up.
- Check for reboots, OOM kills, or full disk around the failure time.
- Ensure stable outbound connectivity to dev.azure.com.
sudo systemctl status vsts.agent.*.service
journalctl -u 'vsts.agent.*' --since '30 min ago'Give the agent more headroom
Provision more memory and disk, or run fewer concurrent jobs per agent, so a heavy job does not exhaust the host.
How to prevent it
- Monitor agent host memory, disk, and network.
- Limit concurrent jobs per agent to avoid resource exhaustion.
- Run the agent as a service so it restarts after a reboot.