GitHub Actions "The hosted runner lost communication with the server"
A hosted runner stopped reporting back to GitHub mid-job, so the service ended the job. This is an infrastructure-side disconnect, not a workflow bug - a clean retry almost always passes.
What this error means
A running job stops abruptly with "The hosted runner lost communication with the server", often after a stretch of no log output. Re-running the same commit succeeds.
Error: The hosted runner: GitHub Actions 12 lost communication with the server.
Anything in your workflow that terminates the runner process, starves it for
resources, or blocks its network access can cause this error.Common causes
Network or service-side disconnect
A transient loss of the runner-to-GitHub connection drops the heartbeat. GitHub ends the job once it has not heard from the runner for too long.
A step starved or killed the runner process
A step that exhausts memory/CPU, blocks the runner network, or kills the agent process can sever communication and trigger this error.
How to fix it
Re-run and right-size the job
- Re-run the failed job; a transient disconnect passes on retry.
- If it recurs, reduce memory/CPU pressure or move the job to a larger runner.
- Avoid steps that block the runner network or kill background agent processes.
Treat it as infrastructure, not a workflow bug
Lost communication is a runner-side failure. A clean retry on a healthy runner is the right first response before changing the workflow.
How to prevent it
- Right-size runners so heavy jobs do not starve the agent.
- Add automatic retries for jobs prone to transient disconnects.
- Avoid commands that block the runner network or kill its processes.