Hunt a race condition
Works nine times out of ten, and the tenth is the bug.
Something intermittent is happening: <describe the symptom and how often> Here's the code: <paste> Look for races specifically: - Two operations that can overlap and touch the same state. - A check followed by an action, with a gap between them where things can change. - Async operations resolving in a different order than they started. - A response arriving after the thing that requested it has gone away. - Two requests both reading, both deciding, both writing. For each: the exact sequence of events that produces the bug, and the fix. Then tell me how I could force that sequence to reproduce it reliably.
"Check then act" is the shape to look for. Anything that reads a value, decides, then writes, has a gap — and under load something will fit into it.