TypeError: Cannot read properties of undefined (reading 'thisRepN')

URL of experiment: Active_mind_for_joy_games [PsychoPy]

Description of the problem: The experiment was running fine from start to finish offline, but I got the error message (TypeError: Cannot read properties of undefined (reading ‘thisRepN’)) right after the demonstration round when I have pushed the experiment to Pavlovia. I have had a look about this thisRepN issue and found that it has not been defined from the beginning of the experiment. Does anybody know how can I fix this? Thanks.

Here’s a screenshot of the error message:

The error comes from if ((trials_2.thisRepN === 1))

trials_2 must be undefined at the point of the code. Which routine is this code in? Is it inside the trials_2 loop?

Thank you for your reply!! It is not in the trials_2 loop, but I found it in earlier in a routine called list_code1, which is in the list_trials_2 loop. Below are the screenshots:

How do I undefine the code? Thanks again!

Is there a reason for that code component to be Both instead of Auto? If you change it to Auto the JS will match the Python.

I have changed the code component to Auto and it worked! Thank you so much!!

Just another question about saving the data though…Our study ideally want participants to each have a customized link for playing the games for 6 weeks. I have managed to customize their links by adding (?participant=xxxx) at the end of the url, so that they only have to press on a single link every time without entering anything (e.g. participant name, session number etc). But then we found that the data would be overwritten if the participants played the games multiple times. Is there any way that the data could be saved every time without overwriting?
Thanks a lot!