# 错误：注册令牌已过期。请在 GitLab 管理区域生成新的注册令牌。

- **ID:** `cicd/gitlab-ci-runner-registration-token-expired`
- **领域:** cicd
- **类别:** auth_error
- **验证级别:** ai_generated
- **修复率:** 92%

## 根因

用于注册运行器的 GitLab Runner 注册令牌已过期，通常是由于令牌轮换策略或在 GitLab 设置中手动撤销。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| GitLab 16.8 | active | — | — |
| GitLab Runner 16.7.0 | active | — | — |

## 解决方案

1. ```
   Generate a new registration token from GitLab admin area: go to Admin > CI/CD > Runners, click 'Register a runner', copy the new token. Then re-register the runner: `sudo gitlab-runner unregister --name my-runner && sudo gitlab-runner register --url https://gitlab.com --registration-token NEW_TOKEN --non-interactive --executor docker --description my-runner`.
   ```
2. ```
   If using GitLab CI/CD variables, update the `CI_REGISTRATION_TOKEN` variable in the project or group settings with the new token, then trigger a pipeline that re-registers the runner automatically.
   ```

## 无效尝试

- **** — The token is stored in the runner's config.toml and is expired on the server side; restarting does not refresh it. (95% 失败率)
- **** — Manually editing the token without proper registration can cause authentication failures; GitLab expects the token to be generated and associated with a specific runner. (80% 失败率)
