What’s your hardest “passes locally, fails only in CI” bug, and how do you approach these now?

I started a conversation about this on LinkedIn and Reddit this week and the replies were brilliant, including one Selenium-on-a-VM failure that a whole team couldn’t crack in over a year.

The pattern I keep seeing is that CI usually isn’t “broken”. My local machine is quietly giving the test something for free:

  • Speed: a faster laptop hides checks that don’t wait or retry
  • Leftover state: already logged in, data already there, CI starts clean
  • Environment: a local-only .env, a UTC runner, locale, window size, browser version
  • Network path: VPN, proxy, split DNS or a company CA the CI image doesn’t have (and curl working doesn’t prove the browser uses the same proxy)
  • Parallel runs: tests that pass alone but clash over shared data

My approach now is to get the trace, logs and screenshots from the failed CI run, reproduce with the same settings locally, and compare where they first differ, before touching retries. As someone put it: retries can hide the cause, but they rarely explain it.

I’m also curious how others are using AI assistants here. I find them good at reading long logs and suggesting theories, but their first “fix” is often a longer timeout or a retry.

I wrote the full checklist up here if it’s useful: It passes on my machine and fails in CI: a practical checklist (and where AI actually helps) - DEV Community

What would you add? And what was the root cause of your worst one?