Record the input, the result you expected and the behavior you observed. Reduce the example until you can reproduce the problem without unrelated code.

Add the explanation in your own words and a small check that would catch the mistake again. The note becomes a resource for your future self.