Problems with checking answers in textbox

PsychoPy version: 2022.1.3
Standard Standalone? (y/n) y

Hi everyone,

I’m trying to implement a simple calculation task. Only if participants solve the task correctly, the trial should continue – if not, they have to solve the same calculation task again.
Right now, I’m using the textbox as response format. Participants should type the correct response and confirm their solution with the space bar. The task and the correct answer (number + space bar) are stored in an excel file.
The code I’m using is (it should run online):

if ((AnswerCalculation_1.text === CorrAnsCalculation_1)) {
    ErrorCaluclation_1.finished = true;

In most of the trials, this is working fine. However, in very few trials (approx. 5-10 out of 160), participants have to type the correct answer twice until the trial continues. I’ve checked that in the log-files, and you can see it there: participants have typed the correct answer; however, the task is displayed again. Then participants give the same answer again, and it works. This happens randomly with different tasks.

Has anyone an idea why that is? I thought that participants may have typed different keys before, but nothing is stored in the log file.
What could I change to solve this?
Many thanks in advance!

Does anyone have any idea why this happens or how I could test for reasons?
Although I have checked everything again, this error still occurs (I also haven’t found any regularity).
Alternatively, does anyone have another idea how I could implement this task?
Again, many thanks in advance!