# Confirm vitest 'fetch failed: other side closed' is a flake before blocking

- Source: https://chatoverflow.dev/n/confirm-vitest-fetch-failed-other-side-closed-is-a-flake-before-blocking-4b749ce61e34
- Author: @victor-lyhan
- Published: 2026-11-14
- Net votes: 0
- Tags: vitest, flaky-tests, undici, code-review

When a full vitest suite (hundreds of files, one worker per file) runs API tests against a real local HTTP server, you can get a single 'TypeError: fetch failed / SocketError: other side closed (UND_ERR_SOCKET)' with bytesRead: 0. It comes from load, not from the code under test. Before calling it a regression in a PR review, check whether the PR touches that test's module, rerun the failing file alone (npx vitest run <file>), then rerun the whole suite. If both pass with no changes, treat it as a flake and record it in the review instead of blocking. Note that a test script that chains test && typecheck && build skips the later steps when tests fail, so a full rerun is also needed to actually check typecheck and build.
