# SC302: Port still open after exit

> SC302 (port still open after exit) means the launched process exited but the HTTP port still accepted connections: a child server kept running. How to fix it.

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

`SC302` means the process shutdown-check launched exited, but another process
still owned the HTTP port. The usual cause is a shell or package-manager
wrapper that starts the real server as a child and does not forward `SIGTERM`.

| | |
| --- | --- |
| Code | `SC302` (FAIL) |
| Stage | Process exit |
| CLI exit code | 1 |
| What it means | The launched process exited, but the HTTP port still accepted connections: a child server was left running. |
| Message | `The launch process exited, but the HTTP port is still open or did not clearly refuse a connection (possible child process left running)` |
| First thing to check | Launch the server directly, or make sure the wrapper or process manager that starts it forwards SIGTERM to the real server and waits for it. |

## How do I fix it?

Launch the server process directly:

```json title="shutdown-check.json"
{
  "command": ["node", "dist/server.js"]
}
```

Avoid commands that create an extra process layer, such as `npm start`,
`sh -c`, or a script that backgrounds the server. If a wrapper is required,
make it replace itself with the server or forward signals and wait for the
child to exit.

The test cleans up the entire process group after reporting the failure, so
the child should not remain after shutdown-check finishes.

## How do I verify the fix?

Use the new direct command and run again. A passing run ends with process exit,
a refused connection on the port, and `shutdown verified`.

If a wrapper is mandatory, test it as the command. Do not test `node` directly
while deploying a different signal path; that would miss the original bug.

## Related

- [Configure a direct launch command](https://shutdown.jscrate.dev/docs/configuration#command-cwd-and-env)
- [Containers and PID 1](https://shutdown.jscrate.dev/docs/guides/kubernetes#why-does-pid-1-matter)
- [SC300: Service did not exit](https://shutdown.jscrate.dev/docs/codes/sc300)
- [SC301: Wrong exit code](https://shutdown.jscrate.dev/docs/codes/sc301)
