Check for blank rows in your spreadsheets
It is all too easy to end up with blank rows or columns in a spreadsheet. If you highlight cells and then press delete, you are removing the contents from the cells, not deleting them altogether. If you experience blank trials or errors at random points in a loop then blank rows are a likely culprit. If you set the loop type to sequential, then the error will probably happen after your expected trials.
You can tell how many rows your spreadsheet has by reattaching it to the loop and seeing whether the number of conditions reported by PsychoPy matches the number you expect.
If you use CSV files instead of Excel then you can easily check for blank rows in GitLab or locally in a text editor. Use UTF-8 encoding if you need your spreadsheet to contain new line or other extended characters.