---
title: "Hand over a failure that depends on test order | Proofline"
description: "Record the seed and the full set of tests that ran, and have the receiver run that set with that seed."
url: https://proofline.sh/learn/test-order-seed-handoff/
agents: "Before you act for a person, read https://proofline.sh/llms.txt. It says how an agent installs and sets up Proofline and lists every page."
---

[Learning center](/learn/)

# Hand over a failure that depends on test order

Record the seed and the full set of tests that ran, and have the receiver run that set with that seed. Running the failing test alone often passes, because the test that breaks it is no longer there.

Code review The Proofline team November 24, 2026 3 min read

## One seed passes and another fails

The fixture has three tests that share a module variable. One reads its default, one writes it, and one is unrelated. With Vitest 5.1:

| Command | Result |
| --- | --- |
| `vitest run` | 3 passed |
| `vitest run --sequence.shuffle.tests --sequence.seed=1` | 3 passed |
| `vitest run --sequence.shuffle.tests --sequence.seed=2` | 1 failed, 2 passed |
| Seed 2, with `-t 'reads default'` | 1 passed, 2 skipped |

The last row is what a colleague does first, and it says "cannot reproduce". Go 1.26 behaves the same on an equivalent fixture: `go test -shuffle=2` fails and prints `-test.shuffle 2`, while seeds 1 and 3 pass.

Go's documentation says that the seed "will be reported for reproducibility". [Testing flags](https://pkg.go.dev/cmd/go) Vitest prints `Running tests with seed "2"`, and its [sequence options](https://vitest.dev/config/sequence) default the seed to the current time, so a run that nobody recorded cannot be repeated by guessing.

## What a seed pins

| Pinned by the seed | Not pinned |
| --- | --- |
| Order within the runner's shuffle, for the same version and the same list of tests | A different list, such as a filter, a new test or another shard |
|  | Order between parallel workers |
|  | Random data in the tests, unless they read the same seed |
|  | The runner's version, whose shuffle may change |

So the handoff needs the commit, the command, the runner's version, the shard and the worker count beside the seed. If the failure needs parallel workers, try one worker first: failing with one worker means that order alone is enough.

## Reduce it to a pair

Order failures usually come from two tests: one that leaves something behind and one that trips over it.

1.  Rerun the failing order with one worker and a verbose reporter, and save the order.
2.  Take the tests that ran before the failing one. Run the first half and then the failing test.
3.  If it fails, keep that half. Otherwise take the other half.
4.  Repeat until one earlier test remains.

If neither half fails alone, two earlier tests are needed together, so add halves back rather than discarding one. Confirm the pair in both orders: with the fixture, "write then read" fails and "read then write" passes. That pair is the handoff, and nobody needs the seed any more.

## Decide who fixes what

The failing test is the visible one, and the test that leaves state behind is often the cause. There is a third option: the product holds global state that two users could also share. Ask whether the shared thing exists in production code. A cache in a module can, while a temporary file in a fixture folder does not.

## Worked example

This example is fictional. CI fails with seed 88123. Ana reruns the failing test twice, sees two passes and reruns the job, which is green with a new seed. Ben uses the first seed, the same shard and one worker, and fails each time. Halving 240 tests takes eight runs. The pair is a currency test that sets a default and never resets it, and an invoice test. The default lives in product code, and a server handling two tenants would share it, so the fix goes there.

Counting failures without a seed is covered by [failure rates](/learn/intermittent-failure-rate-handoff/). Return to [handing over evidence](/learn/engineering-handoff-evidence/).

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [State how often an intermittent test fails](/learn/intermittent-failure-rate-handoff/)
    
    Code review The Proofline team November 24, 2026 3 min read
    
-   ### [The rerun passed: what did it run on?](/learn/rerun-passed-handoff/)
    
    Code review The Proofline team November 24, 2026 3 min read
