# 诊断码

> shutdown-check 诊断码一览：每个 SC 码的含义、它来自检查的哪个阶段，以及该怎么修复，从 SC000（通过）到 SC999。

Source: https://shutdown.jscrate.dev/zh/docs/codes
Last updated: 2026-09-23

每次运行 shutdown-check 都会以一个诊断码结束。`SC000` 表示通过。其他诊断码都指向第一个失败的阶段，你可以直接从服务的相关部分查起，不必读完整条时间线。

## 查找诊断码

| 诊断码 | 发生了什么 | 结果 |
| --- | --- | --- |
| [SC000](https://shutdown.jscrate.dev/zh/docs/codes/sc000) | 优雅关闭验证通过 | PASS |
| [SC001](https://shutdown.jscrate.dev/zh/docs/codes/sc001) | 端口已被占用 | FAIL |
| [SC002](https://shutdown.jscrate.dev/zh/docs/codes/sc002) | 缺少启动命令 | FAIL |
| [SC100](https://shutdown.jscrate.dev/zh/docs/codes/sc100) | 服务一直未就绪 | FAIL |
| [SC101](https://shutdown.jscrate.dev/zh/docs/codes/sc101) | 服务在就绪前退出 | FAIL |
| [SC110](https://shutdown.jscrate.dev/zh/docs/codes/sc110) | 探测路由一开始就处于活跃状态 | FAIL |
| [SC111](https://shutdown.jscrate.dev/zh/docs/codes/sc111) | 测试请求始终未处于进行中 | FAIL |
| [SC112](https://shutdown.jscrate.dev/zh/docs/codes/sc112) | 在 SIGTERM 前已退出 | FAIL |
| [SC113](https://shutdown.jscrate.dev/zh/docs/codes/sc113) | SIGTERM 无法送达 | FAIL |
| [SC114](https://shutdown.jscrate.dev/zh/docs/codes/sc114) | 第二次 SIGTERM 无法送达 | FAIL |
| [SC200](https://shutdown.jscrate.dev/zh/docs/codes/sc200) | 进行中的请求未完成 | FAIL |
| [SC201](https://shutdown.jscrate.dev/zh/docs/codes/sc201) | 进行中的请求被中断 | FAIL |
| [SC202](https://shutdown.jscrate.dev/zh/docs/codes/sc202) | 进行中的请求状态码错误 | FAIL |
| [SC203](https://shutdown.jscrate.dev/zh/docs/codes/sc203) | 进行中请求的响应体错误 | FAIL |
| [SC300](https://shutdown.jscrate.dev/zh/docs/codes/sc300) | 服务未按时退出 | FAIL |
| [SC301](https://shutdown.jscrate.dev/zh/docs/codes/sc301) | 服务退出码错误 | FAIL |
| [SC302](https://shutdown.jscrate.dev/zh/docs/codes/sc302) | 退出后端口仍未关闭 | FAIL |
| [SC310](https://shutdown.jscrate.dev/zh/docs/codes/sc310) | 未撤回就绪状态 | FAIL |
| [SC311](https://shutdown.jscrate.dev/zh/docs/codes/sc311) | 排空期间接受了新请求 | FAIL |
| [SC312](https://shutdown.jscrate.dev/zh/docs/codes/sc312) | 请求结束过早，无法测试拒绝 | FAIL |
| [SC999](https://shutdown.jscrate.dev/zh/docs/codes/sc999) | 意外错误 | FAIL |

## 诊断码是怎么分组的？

| 范围    | 阶段               | 从这里查起                                           |
| ------- | ------------------ | ---------------------------------------------------- |
| `SC000` | 通过               | 回顾这次测试覆盖了哪些内容                           |
| `SC0xx` | 启动前             | 检查端口和启动命令                                   |
| `SC1xx` | 启动与测试请求准备 | 检查就绪检查（readiness）、启动确认（start barrier）和信号投递 |
| `SC2xx` | 进行中的请求       | 检查未完成的请求能否以预期的响应结束                 |
| `SC30x` | 进程退出           | 检查截止时间、退出码和子进程                         |
| `SC31x` | 排空流量           | 检查是否撤回了就绪状态、是否拒绝了新请求             |
| `SC999` | 意外错误           | 阅读原始错误，排除手写配置无效的可能                 |

只会报告第一个失败。例如，一个进行中的请求被切断，同时进程的退出码也不对，你会先看到请求的错误。先修复这个错误，重新运行测试，再处理后面的失败。

## 如何阅读输出？

先看 `check failed` 之前的最后一个时间线事件，它说明测试进行到了哪一步。然后打开对应诊断码的页面，按顺序执行其中的修复步骤。如果运行在产生 SC 码之前就停止了，请参考[故障排查指南](https://shutdown.jscrate.dev/zh/docs/troubleshooting)。

## 相关内容

- [关闭测试的运行过程](https://shutdown.jscrate.dev/zh/docs/how-it-works)
- [输出与时间线参考](https://shutdown.jscrate.dev/zh/docs/output)
- [配置参考](https://shutdown.jscrate.dev/zh/docs/configuration)
- [按症状排查问题](https://shutdown.jscrate.dev/zh/docs/troubleshooting)
