Pavlovia see my loops as routines, and gives undefinable data (IMMEDIATE)

URL of experiment: Pavlovia ; or Pavlovia

Description of the problem: Pavlovia looks my subloops as routines within the bigger loop in JS codes. Also, It does not care my codes for different responses in recognition part, it does not present my routines according to response type, it does not save my code changes on JS, when I changed the codes, it stays on always initialising. Furthermore, it gives excessively incompherensible data not being fit to my stimuli.

What error do you receive when you are stuck on initializing?
Also, your experiment is private, so we cannot access it and have a look ourselves.


Hello Chen,

I turned it to public, I have not received any errors. When I run, it flows without caring my codes, I change the codes on JS it stays initialising.

No information is available for this experiment. Either it does not exist or you do not have access to it.

It is still private


Pavlovia could you try here again, I turned it to public now again.

Did you write your code manually (through the coder)/did you work through the builder?

I used builder at the begining, and then I change some codes manually.

You do receive an error (Inspect → Console):
damlalnby/drm_exp/DRM_EXP.js:5515 Uncaught SyntaxError: Unexpected token 'else'

When taking a closer look at your code, there is indeed a problem there, a line you forgot to remove/modify (There is no statement after the else if, and it’s also inside the if loop without an if statement beforehand):

for (const thisRecognition_cold of recognition_cold) {
      snapshot = recognition_cold.getSnapshot();
      if ((response_cold.keys === "f")) {
                    else if 
      recognition_coldLoopScheduler.add(recognition_coldLoopEndIteration(recognition_coldLoopScheduler, snapshot));


Hi Chen,

Yes, there was a situation after else if as ((response_cold.keys === “r”)) { , and else if ((response_cold.keys === “n”)) { before new loop, it does not save my changes completely. My aim is to adjust experiment if participant press f, familiarity routine and loop should be carried out, else they press r, recollection loop and routine, if they press n, new routine and loop should be presented. However it always present all conditions independent from response.

I would recommend that you go back to your last Builder version and set code components to Both when the Auto translate tool fails you. Editing the JS files directly should only be done if you are sure there is no other way and know exactly what edit you are making.


Hi wakecarter,

I changed on builder as “both” before, unfortunately does not work :frowning:


PsychoPy generates the JavaScript each time you sync the experiment. So if you manually edit the JavaScript code, it will be overwritten when the experiment is synced. So a better approach than manually editing the JavaScript code is to 1) set the code element to auto-translate and in a second step 2) set it to both and edit the JavaScript to your needs. Alternatively, you could introduce JavaScript-only code elements. Both approaches would ensure that the JavaScript code is properly synchronised.

Well, you don’t tell us what didn’t work here. You may still have a syntax error in your JavaScript.

Best wishes Jens

Hi Jen,

I told what does not work above to Chen, you can see my document in Chens answer. As we see in the image which Chen shared, JS does not save my changes on the document, it took just some parts of the code I write. Also, when I complete the code again it stays always on initialising. I tried both ways you offered, auto JS was the automatic option at the first but it did not work, I had received reference error before this problem, I had aware that it was taking loops as if they are routines. I solved this with the manual code as well as I created new JS and Py scripts again, I solved reference error. However, it neither saved this correct solution nor worked the codes on the builder appropriately. After, I tried use both option for codes, also I used only JS option even i copy and paste JS codes from builder to the script, none solved the problem. I will try Wakecarters advice, I will let you inform later again.



it is certainly a good idea to go to the last version that worked as @wakecarter suggested. The fact your experiment is stuck on initializing shows that your JavaScript code is not bug-free.

I do not understand how you edit and save your JavaScript. JavaScript is unformatted text that can be edited and saved in any text editor.

It is not uncommon to get a reference error when moving to PsychoJS (online) from PsychoPy (offline). Often this is easily resolved.

Best wishes Jens

1 Like

Hi Jens,

As I said before, I have not received any reference errors anymore, just my experiment’s recognition phase does not work appropriate to the codes in builder, when I change the codes on JS, it ignores my editions, when I open experiment next time, I find it on the last version. That’s more make sense definition of my problem I guess.


Hello Damla

Sure, it makes the most sense to use an older running version. I just wanted to explain the workflow of PsychoPy for online experiments and why it makes sense not to manually edit the PsychoJS script when using the Builder to push the experiment.

Best wishes Jens

Hi, I have just created a new project but it shows software unknown and when I try to sync I have gotten this error on PsychoPy.

Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\”, line 1369, in onPavloviaSync
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\”, line 808, in fileExport
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\”, line 729, in showCoder
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\coder\”, line 2734, in setOutputWindow
File “C:\Program Files\PsychoPy\lib\site-packages\wx\lib\agw\aui\”, line 6388, in Update
File “C:\Program Files\PsychoPy\lib\site-packages\wx\lib\agw\aui\”, line 6582, in DoUpdate
File “C:\Program Files\PsychoPy\lib\site-packages\wx\lib\agw\aui\”, line 8773, in Repaint
client_dc = wx.BufferedDC(wx.ClientDC(self._frame), wx.Size(w, h))
wx._core.wxAssertionError: C++ assertion “m_buffer && m_buffer->IsOk()” failed at …..\src\common\dcbufcmn.cpp(134) in wxBufferedDC::UnMask(): invalid backing store

The project link: Damla ALANBEY / DRM_EXP_new · GitLab

Try to close your coder and sync it through the builder.


Hi Chen I tried, but when I try sync I always get this error:
Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\”, line 1426, in onPavloviaSync
pavlovia_ui.syncProject(parent=self, file=self.filename, project=self.project)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\pavlovia_ui\”, line 854, in syncProject
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\pavlovia_ui\”, line 47, in sync
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\”, line 840, in sync
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\”, line 1027, in firstPush
info = self.repo.git.push(‘-u’, self.remoteWithToken, ‘master’)
File “C:\Program Files\PsychoPy\lib\site-packages\git\”, line 638, in
return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
File “C:\Program Files\PsychoPy\lib\site-packages\git\”, line 1183, in _call_process
return self.execute(call, **exec_kwargs)
File “C:\Program Files\PsychoPy\lib\site-packages\git\”, line 983, in execute
raise GitCommandError(redacted_command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd(‘C:\Program Files\PsychoPy\MinGit\cmd\git.exe’) failed due to: exit code(128)
cmdline: C:\Program Files\PsychoPy\MinGit\cmd\git.exe push -u Sign in · GitLab master
stderr: ‘fatal: unable to update url base from redirection:
asked for: Sign in · GitLab
redirect: Sign in · GitLab


error code 128 can mean a lot of things for git. One is that the ssh key is no longer valid. Can you log in to git with your credentials?

Best wishes Jens