Look at the code, fully understand how code works and try to find out which part might went wrong.
Start with the observable facts and work backwards, asking why repeatedly, until I can describe the pattern that underlies the bug.
asking why repeatedly
describe the pattern that underlies the bug