If you work in test automation long enough, you get a very specific kind of message from your pipeline. Red build. You pull the branch, run the same test locally, and it's green. You run it again. Green. You run it ten times. Still green.
Then CI runs it again and it fails.
This week I asked other testers for their strangest "only fails in CI" bugs, and the replies were a mix of comfort and horror. One person described a Selenium failure on a VM that devs, DevOps and testers had been chasing for over a year. Nobody had cracked it.
So this isn't a "five easy fixes" post. Some of these are genuinely hard. But most CI-only failures I've seen fall into a handful of buckets, and knowing the buckets makes the search a lot shorter.
The pattern behind most of them
CI usually isn't broken. Your machine is quietly giving the test something for free, and CI isn't.
Once you think about it that way, the question changes from "why is CI flaky?" to "what does my laptop have that the runner doesn't?"
1.…