# 错误：运行器注册令牌已过期。请生成新令牌并重新注册运行器。

- **ID:** `cicd/github-actions-self-hosted-runner-token-expired`
- **领域:** cicd
- **类别:** auth_error
- **错误码:** `RUNNER_TOKEN_EXPIRED`
- **验证级别:** ai_generated
- **修复率:** 85%

## 根因

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

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| GitHub Actions runner v2.311.0 | active | — | — |
| Ubuntu 22.04 runner image | active | — | — |

## 解决方案

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
   ```

## 无效尝试

- **Restart the runner service without re-registering** — Restarting does not refresh the expired token; authentication still fails (95% 失败率)
- **Delete and recreate the runner in GitHub UI without generating a new token** — The same expired token is reused; the runner still cannot connect (80% 失败率)
- **Update the runner version only** — The token is independent of runner version; updating version does not fix token expiry (90% 失败率)
