# 错误：自托管运行器 'self-hosted-runner-01' 处于离线状态，无法接受任务。请确保运行器正在运行并已连接。

- **ID:** `cicd/github-actions-self-hosted-runner-offline`
- **领域:** cicd
- **类别:** system_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

自托管的 GitHub Actions 运行器因网络问题、运行器进程过期或令牌过期而失去与 GitHub 的连接，导致无法分配任务。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| GitHub Actions runner 2.300.0 | active | — | — |
| Ubuntu 22.04 | active | — | — |
| Windows Server 2022 | active | — | — |

## 解决方案

1. ```
   Run the runner's config script with --replace to regenerate the token and reconnect: ./config.sh remove --token <token> && ./config.sh --url https://github.com/org/repo --token <new_token>
   ```
2. ```
   Check runner logs at ~/actions-runner/_diag/Runner_*.log for specific errors (e.g., HTTP 401) and fix network or proxy settings accordingly.
   ```

## 无效尝试

- **** — Restarting the runner service without checking logs may mask underlying issues like token expiry. (40% 失败率)
- **** — Uninstalling and re-installing the runner is overkill and loses configuration; often a simple reconnect suffices. (20% 失败率)
- **** — Killing the runner process and restarting may not fix token issues if the runner is not properly re-authenticated. (30% 失败率)
