# SC200: In-flight request did not finish

> SC200 (in-flight request did not finish) means a request running at SIGTERM did not complete before the shutdown deadline. The causes and how to fix them.

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

`SC200` means an active request was still open when the shutdown deadline
ended. It did not complete and it did not fail; the connection stayed open.

| | |
| --- | --- |
| Code | `SC200` (FAIL) |
| Stage | In-flight responses |
| CLI exit code | 1 |
| What it means | A request that was running when SIGTERM arrived did not complete before the shutdown deadline. |
| Message | `In-flight request #<n> did not finish within <shutdown.deadlineMs> ms` |
| First thing to check | Stop accepting connections with `server.close()` and let open requests finish; do not wait on keep-alive sockets or timers that never end. |

## Why does a request hang?

- The shutdown handler waits for the request, but the request waits for
  shutdown cleanup.
- A database call, upstream request, or lock never finishes.
- The server stops reading or writing without closing the response.
- `shutdown.deadlineMs` is shorter than the expected operation.
- A timer or stream is left open.

## How do I fix it?

1. Add logs around the slow handler and each shutdown step.
2. Let active handlers finish before closing their dependencies.
3. Put timeouts on network, database, and queue operations.
4. Set `deadlineMs` above the slowest valid request, but below the platform's
   termination limit.

Do not call `process.exit()` to clear this code. That cuts the connection and
turns the failure into [SC201](https://shutdown.jscrate.dev/docs/codes/sc201).

## How do I verify the fix?

The timeline should show `work request finished` before the deadline. Add
`bodyIncludes` when a normal-looking response could still hide incomplete
work.

Test with the slowest valid operation, not only a fixed sleep. If external
systems can stall, verify their own timeout path as a separate failure test.

## Related

- [Write a graceful shutdown handler](https://shutdown.jscrate.dev/docs/guides/graceful-shutdown-nodejs)
- [Set the shutdown deadline](https://shutdown.jscrate.dev/docs/configuration#shutdown)
- [SC201: Request interrupted](https://shutdown.jscrate.dev/docs/codes/sc201)
- [SC300: Service did not exit](https://shutdown.jscrate.dev/docs/codes/sc300)
