Experiment works on Chrome, doesn't work on Safari: psychoJS.experiment._unfinishedLoops.at is not a function

URL of experiment: DT_selfpacedreading [PsychoPy]

Description of the problem:
Hi all, my experiment works locally, but when it’s online I get the following error message in the middle of the first few trials:

For Safari:
Unfortunately we encountered the following error:
TypeError: psychoJS.experiment._unfinishedLoops.at is not a function. (In ‘psychoJS.experiment._unfinishedLoops.at(-1)’, ‘psychoJS.experiment._unfinishedLoops.at’ is undefined)

For Chrome, it generally works, but one person has reported they encountered the following:
Unfortunately we encountered the following error:
TypeError: psychoJS.experiment._unfinishedLoops.at is not a function.

I’d really appreciated it if anyone can give some pointers on what seems to be causing this. Many thanks in advance!!

1 Like

Did you get anywhere with this? I’m encountering it when ending a loop early.

if trials.thisTrialN == 6:
    trials.finished = True

if ((trials.thisTrialN === 6)) {
    trials.finished = true;

I have a loop called trials and an outer loop called blocks.

N.B. This might be related to my phone being old (an iPhone6) since this demo also crashes.

@wakecarter the demo in the link your posted works fine on my android using Edge

Hi! Thank you so much for taking a look at this! I ended up asking my participants to just not use Safari as it’s taking me too long to troubleshoot. Four participants encountered the error message when using Chrome, but it worked fine for the rest 120 participants.

A similar demo loopname_bug_demo works on my iPhone6 but currentlooptest crashes in both Safari and Chrome. I’m not sure of the difference between the two demos.

Hey @Mei and @wakecarter,

Have you had any progress with this issue? I encounter the same error mid-experiment when I press a key to advance to the next screen. The problem is unique to Safari and doesn’t happen on any other browser.

What phone / MacOS are you using?

I am using macOS Catalina 10.15.6.

And does currentlooptest crash?

What version of PsychoPy are you using?

Yes it crashes (only on Safari). I’m using the latest version of PsychoPy (2022.2.3). This is the error I get:

Has anyone found a solution for this? I had a participant have this issue running things on chrome, but it works fine on my chrome browser. This happens with any task and the tasks otherwise work on other computers when I test them elsewhere.

I’ve been getting this too on my iPhone6 whenever I have an experiment which needs to finish a loop early. My solution is to switch the PsychoPy version in Experiment Settings to 2022.1.4. Will that work for you?

Thank you so much for the suggestion.
Unfortunately, that didn’t work for the RA I was piloting with. They tried on their ipad and it worked, then tried on their laptop with safari instead of chrome and safari apparently just closed the window on them.
I’ll get them to try again today, since I’ve also been having syncing issues (the files are synced on the git but the task still runs as an older version). The syncing issues usually resolve if I give it some time though. Hopefully they can send me the messages from the console to see if there are more hints there.

This is a cache issue which I solve by using Ctrl-Shit-R in Chrome or an incognito tab.

Ah! I tried doing ctrl+shift+R before and it didn’t work. I’ll try that again.

Also, the RA got back to me and apparently the older version of psychopy worked on chrome. Doesn’t help with safari apparently. At least that’s one browser that’s useable though!

Thanks again!

I also encountered this error with some subjects. And it worked fine with the others. Very Weird.

I am also having this error in Safari (but not Chrome or Firefox) for two recent experiments designed in 2022.2.2. Earlier experiments I’ve designed/run in 2022.x.x with roughly similar loop structures seem to continue to run fine in Safari however.

I’m testing different versions of PsychoPy in the experiment settings, but is this something others have come across recently as well? The errors seem to appear at the end of trial loops even if they are not finishing early, but I’m still trying to find out the exact conditions that it happens. Thanks.

If you are reading this and have an old device, please let me know if you still get an error with the right hand button in this demo which is written in 2023.2.0


If you get the error, please post information about your OS and browser.

Hi there, I have the same error as described here but when running your experiment in loop-test [PsychoPy] on Safari, it works just fine. Could you maybe explain how exactly you fixed the problem so I can implement it into my code? That would be fantastic. Thanks so much in advance!

There’s nothing special about the code.

if key_resp.keys == 'right' or text_2.contains(mouse):
    trials.finished = True

However, the version is that demo is now 2023.2.3 (the current release). What version are you using?