RUNNER_TOKEN_EXPIRED cicd auth_error ai_generated true

Error: The runner registration token has expired. Please generate a new token and re-register the runner.

ID: cicd/github-actions-self-hosted-runner-token-expired

Also available as: JSON · Markdown · 中文
85%Fix Rate
88%Confidence
1Evidence
2023-08-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
GitHub Actions runner v2.311.0 active
Ubuntu 22.04 runner image active

Root Cause

GitHub Actions self-hosted runner registration token expires after 1 hour, and the runner cannot authenticate with GitHub if the token is not refreshed.

generic

中文

GitHub Actions 自托管运行器注册令牌在1小时后过期,如果令牌未刷新,运行器无法与GitHub进行身份验证。

Official Documentation

https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/adding-self-hosted-runners

Workarounds

  1. 90% success Generate a new registration token from GitHub Settings > Actions > Runners > Remove runner > Add runner, then re-run the configure script with the new token: ./config.sh --url https://github.com/your-org/your-repo --token NEW_TOKEN ./run.sh
    Generate a new registration token from GitHub Settings > Actions > Runners > Remove runner > Add runner, then re-run the configure script with the new token:
    ./config.sh --url https://github.com/your-org/your-repo --token NEW_TOKEN
    ./run.sh
  2. 85% success Automate token refresh using a cron job or GitHub Actions workflow that calls the API to get a new token and updates the runner configuration daily
    Automate token refresh using a cron job or GitHub Actions workflow that calls the API to get a new token and updates the runner configuration daily

中文步骤

  1. Generate a new registration token from GitHub Settings > Actions > Runners > Remove runner > Add runner, then re-run the configure script with the new token:
    ./config.sh --url https://github.com/your-org/your-repo --token NEW_TOKEN
    ./run.sh
  2. Automate token refresh using a cron job or GitHub Actions workflow that calls the API to get a new token and updates the runner configuration daily

Dead Ends

Common approaches that don't work:

  1. Restart the runner service without re-registering 95% fail

    Restarting does not refresh the expired token; authentication still fails

  2. Delete and recreate the runner in GitHub UI without generating a new token 80% fail

    The same expired token is reused; the runner still cannot connect

  3. Update the runner version only 90% fail

    The token is independent of runner version; updating version does not fix token expiry