Troubleshooting Runner Issues

Earn 25 points (50 with Pro) in two steps

  1. ① Read through the lesson — each section gets a ✓ as you scroll through it.
  2. ② When every section has a ✓, tap Complete lesson.

0 of 9 read · keep scrolling

✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro

Troubleshooting GitHub Actions Runners

GitHub Actions has become the backbone of modern software delivery, allowing teams to automate testing, building, and deployment processes directly within their repositories. At the heart of this automation lies the "runner," the machine that actually executes the jobs defined in your workflow files. While GitHub-hosted runners offer a convenient, maintenance-free environment, many organizations rely on self-hosted runners to access private networks, use specialized hardware, or manage costs.

When a workflow fails, the cause is often not the code itself, but the environment in which it runs. Troubleshooting these runner issues is a critical skill for DevOps engineers and platform administrators. This lesson covers the anatomy of runner failures, systematic debugging strategies, and the operational best practices required to maintain a healthy automation infrastructure.

Not read yet

Understanding the Runner Lifecycle

To effectively troubleshoot a runner, you must first understand how it communicates with GitHub. A runner is essentially a background process—the runner application—that polls the GitHub Actions service for new jobs. When a job is assigned, the runner downloads the workflow definition, executes the steps, reports logs back to GitHub, and then waits for the next task.

The communication happens over HTTPS (typically port 443) using long-polling or WebSockets. Because the runner initiates the connection to GitHub, you generally do not need to open inbound firewall ports. However, this architecture means that any disruption in network connectivity, authentication tokens, or local system resources can bring your automation to a halt.

The Anatomy of a Runner Failure

Runner issues typically manifest in one of three ways:

  1. The runner is offline: The GitHub interface shows the runner as "Offline," meaning the application is either not running or cannot reach GitHub.
  2. Jobs are stuck in "Queued": The runner is online, but it is not picking up jobs, often due to mismatched labels or authentication issues.
  3. Jobs fail during execution: The runner starts the job, but it crashes or exits with errors, usually due to disk space, memory limits, or environmental configuration issues.

Callout: GitHub-Hosted vs. Self-Hosted It is essential to distinguish between these two. GitHub-hosted runners are ephemeral, managed by GitHub, and reset after every job. If you see failures here, the issue is almost always your workflow configuration or environment dependencies. Self-hosted runners, however, are persistent. They accumulate state, temporary files, and configuration drift, which are the primary sources of "heisenbugs" in your CI/CD pipeline.

Not read yet

Systematic Troubleshooting Workflow

When a runner stops behaving as expected, do not jump straight to reinstalling the software. Follow a structured approach to isolate the problem.

Phase 1: Verify Connectivity and Status

The first step is to check the GitHub UI. Navigate to your repository or organization settings, select "Actions," and then "Runners." If the status icon is red, the runner process has lost contact with the GitHub server.

  • Check the service status: On Linux systems, use systemctl status actions.runner.*. On Windows, check the "Services" management console.
  • Review network logs: If the service is running but offline, check the runner’s internal log files located in the _diag directory within your runner installation folder. Look for "Connection reset" or "DNS resolution" errors.
  • Test egress: Use a simple tool like curl to verify that the runner machine can reach github.com and the necessary API endpoints.

Phase 2: Inspecting the Runner Logs

The _diag folder is your most valuable resource. Every time a runner starts or executes a job, it writes detailed logs. You will typically find two types of logs:

  1. Runner logs: These track the connection state, heartbeats, and internal service health.
  2. Job logs: These track the execution of a specific workflow run.

When troubleshooting, open the latest log file and search for the [ERROR] or [WARNING] tags. Often, you will find information about "Job request failed" or "Unable to get job message," which points directly to authentication token expiration or connectivity drops.

Phase 3: Handling Authentication Issues

Self-hosted runners use a registration token to join the pool. If this token expires or if the runner's internal credentials (the .credentials and .credentials_rsaparams files) become corrupted, the runner will fail to authenticate with GitHub.

If you suspect authentication issues, you can force a re-registration:

  1. Stop the runner service.
  2. Remove the runner from the GitHub UI.
  3. Delete the .credentials and .credentials_rsaparams files in the runner directory.
  4. Re-run the ./config.sh script with a fresh token.

Not read yet

Common Runner Issues and Solutions

1. Disk Space Exhaustion

Self-hosted runners generate significant amounts of data. Between the source code, build artifacts, Docker layers, and the _diag logs, it is common for the runner's disk to fill up. When this happens, the runner may stop accepting jobs or fail mid-execution without a clear error message in the UI.

  • Prevention: Implement a cleanup cron job that removes old _diag logs and prunes unused Docker images.
  • Diagnosis: If a job fails immediately with "No space left on device," check the partition usage on the runner host.

2. Orphaned Processes

Sometimes, a job might be cancelled or timed out, but the processes it spawned (like a background server or a database container) continue to run. Over time, these "zombie" processes consume CPU and memory, eventually slowing down subsequent jobs.

  • Strategy: Ensure your workflows use proper cleanup steps. Use post actions to terminate background services explicitly.
  • Maintenance: Periodically restart the runner service. A scheduled reboot of the runner host once a week can resolve many hidden resource leaks.

3. Environment Mismatches

A common pitfall is assuming the environment on the runner is identical to a developer's local machine. If your workflow relies on node, python, or docker, ensure they are installed in the expected paths and that the versions match the workflow requirements.

Warning: Global vs. Local Dependencies Never rely on global installations of tools on your runners. If a job requires a specific version of a tool, use actions like actions/setup-node or actions/setup-python to install the dependency into the runner's workspace dynamically. This ensures consistency and prevents "it works on my machine" issues.

Not read yet

Deep Dive: Managing Runner Capacity and Scaling

Scaling runners is a classic DevOps challenge. If you have too many jobs and not enough runners, your pipeline slows down. If you have too many runners, you waste money.

Implementing Autoscaling

For cloud-based infrastructure, you should never manage runners manually. Use tools like the Actions Runner Controller (ARC) on Kubernetes. ARC automatically monitors the GitHub Actions queue and spins up new runner pods when jobs are pending.

When troubleshooting ARC:

  1. Check the controller logs: The controller manages the lifecycle of the runners. If pods aren't scaling, the controller logs will tell you if it lacks permissions to the Kubernetes API.
  2. Inspect the pod logs: If a runner pod enters a CrashLoopBackOff, it is usually due to an invalid registration token or a misconfigured runner image.

Runner Groups and Permissions

If you are managing runners at the organization level, you might encounter issues where workflows cannot access specific runners. This is often a "Runner Group" configuration error.

  • Check Policies: Verify that the repository is explicitly allowed to use the runner group.
  • Labels: Ensure the runs-on label in your workflow file exactly matches the labels assigned to the runner. Labels are case-sensitive and must be configured correctly in the runner's settings.

Not read yet

Comparison Table: Troubleshooting Scenarios

Issue Symptom Likely Cause Primary Action
Runner "Offline" in UI Network or Service failure Check systemctl status and _diag logs
Job "Queued" indefinitely Label mismatch or Auth error Verify labels and re-register runner
Job fails with "Disk Full" Artifact accumulation Prune Docker images and old logs
Job fails with "Permission Denied" Improper service user Ensure runner runs as a dedicated user
Slow build times Resource contention Audit other processes on the host machine

Best Practices for Runner Maintenance

To minimize the time spent troubleshooting, follow these industry-standard operational practices.

1. Dedicated Service Accounts

Never run the GitHub Actions runner application as root or as a standard user account that has broad permissions. Create a dedicated github-runner user with limited privileges. This prevents a compromised build process from gaining full control over the host machine.

2. Ephemeral Runners

Whenever possible, configure your runners to be "ephemeral." By passing the --ephemeral flag during configuration, you tell the runner to exit after processing a single job. This forces the runner to be recreated for every task, effectively eliminating configuration drift and state-related bugs.

# Example of configuring an ephemeral runner
./config.sh --url https://github.com/my-org/my-repo --token <TOKEN> --ephemeral

3. Monitoring and Alerting

Do not wait for developers to complain that the builds are failing. Set up basic monitoring on your runner hosts. Use tools like Prometheus or CloudWatch to monitor:

  • CPU and Memory utilization percentages.
  • Disk space availability on the /home/runner partition.
  • The status of the runner service (trigger an alert if the process stops).

4. Standardized Images

If you use virtual machines as runners, use Infrastructure as Code (Terraform, Packer, Ansible) to build and update them. Never manually configure a runner host. If a runner starts behaving erratically, the standard procedure should be to terminate the instance and let your automation recreate it from the base image.

Not read yet

Common Pitfalls to Avoid

Ignoring the .runner file

The .runner file contains the persistent configuration of your installation. If you accidentally copy this file between different runner hosts, both runners will attempt to authenticate with the same identity. This creates a "race condition" where jobs are randomly assigned to one of the two runners, causing mysterious failures. Always treat the runner installation as a unique entity.

Overlooking Proxy Configurations

If your runners are behind a corporate proxy, standard installation will fail. You must export the https_proxy and http_proxy environment variables in the environment where the runner service starts. On Linux, this often involves editing the systemd service file to include Environment="https_proxy=http://proxy.example.com:8080".

Neglecting Security Updates

Because runners execute arbitrary code from your repositories, they are a high-value target. Ensure that the host OS is patched regularly. If you use Docker-based runners, ensure the base images are scanned for vulnerabilities and updated frequently.

Not read yet

Managing Runner Updates

GitHub frequently releases updates to the runner application. Usually, the runner handles these updates automatically. However, if the auto-update process fails, the runner might become incompatible with the latest features of the GitHub Actions platform.

  • Manual Update: If the runner is stuck on an old version, you can manually trigger an update by stopping the service and running the ./bin/Runner.Listener update command.
  • Version Pinning: While you cannot pin the runner version to an old state indefinitely, you can monitor the version in the runner settings to ensure your fleet is not falling too far behind.

Practical Example: Debugging a Failing Job

Imagine a scenario where a job fails with the error: Error: The process '/usr/bin/docker' failed with exit code 1.

  1. Isolate: Does this happen on all runners or just one? If it's just one, the issue is local to that host.
  2. Verify: Log into the problematic runner host. Try to run a simple docker run hello-world.
  3. Analyze: If the command fails, the Docker daemon might be down. Check systemctl status docker.
  4. Fix: If the daemon is down, restart it. If it’s running but the command fails, check the Docker logs (journalctl -u docker) to see if the storage driver is corrupted or if the disk is full.
  5. Validate: Once fixed, manually trigger the workflow again to ensure the runner picks it up correctly.

Tip: The "Shell" Trick If you have trouble debugging a complex script inside a job, use the tmate action. It allows you to SSH into the runner environment while the job is paused, giving you a live terminal to inspect the file system, environment variables, and process list exactly as the runner sees them.

Not read yet

Key Takeaways

Troubleshooting GitHub Actions runners requires a blend of infrastructure knowledge and application-level debugging. By following these guidelines, you can build a resilient CI/CD pipeline:

  • Logs are your primary source of truth: Always start by inspecting the _diag directory for clues before making changes to the system.
  • Prioritize ephemeral runners: Whenever possible, use the --ephemeral flag to ensure each job starts from a clean slate, reducing the impact of configuration drift.
  • Automate infrastructure: Use IaC to provision runner hosts and monitoring tools to proactively alert you when disk space or system resources are low.
  • Isolate the network: Ensure your runners have stable, unrestricted access to the GitHub API endpoints, and be aware of proxy configurations in your environment.
  • Standardize the environment: Avoid global dependencies; use dedicated setup actions to manage language versions and toolchains within the workflow.
  • Secure the host: Treat runners as production assets. Run them with the principle of least privilege and keep the host operating system updated.
  • Establish a recovery process: Have a clear, repeatable process for re-registering runners and replacing unhealthy hosts rather than trying to perform "surgery" on a broken instance.

By treating your runners as a managed service rather than "set and forget" hardware, you will significantly reduce the time spent troubleshooting and ensure your development teams remain productive and unblocked. Consistency, observability, and automation are the three pillars of a stable GitHub Actions runner environment.

Not read yet

Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.