A Playwright test fails on its first attempt and passes on a configured retry, so Playwright marks it "flaky." Usually a race: asserting before the UI settles, a fixed sleep, or shared state between tests.
What this error means
The HTML report shows the test as "flaky" - failed then passed - and CI is green overall. The failure moves around between runs, the signature of a timing race rather than a real bug.
playwright
Running 120 tests using 4 workers
✓ tests/cart.spec.ts:12:1 › adds to cart (retry #1)
1 flaky
tests/cart.spec.ts:12:1 › adds to cart
Common causes
Asserting before the app settles
A non-retrying check runs right after an action that triggers async work (XHR, animation), so it sometimes reads a pre-update state.
Fixed sleeps and shared state
A waitForTimeout(500) is sometimes too short, or tests share storage/server state, making outcomes order- and timing-dependent.
How to fix it
Use web-first, auto-retrying assertions
Assert on the readiness signal so the test waits exactly as long as needed instead of a fixed sleep.
Replace fixed sleeps with web-first expect assertions.
Give each test its own storage/server state.
Capture traces on first retry to debug intermittency fast.
Frequently asked questions
What causes "Flaky - passes on retry"?
A non-retrying check runs right after an action that triggers async work (XHR, animation), so it sometimes reads a pre-update state.
How do I fix Flaky - passes on retry?
Assert on the readiness signal so the test waits exactly as long as needed instead of a fixed sleep.
Can Latchkey fix this automatically?
Yes. Latchkey runs your GitHub Actions on managed runners that detect this failure, apply the fix, and retry the job automatically - self-healing is on by default.