Pavlovia sync errors and browser experiments failing, even with a simple experiment, ERR_EMPTY_RESPONSE at localhost:12002

OS (e.g. Win10): Windows 11

PsychoPy version (e.g. 2024.2.4 Py 3.8): PsychoPy 2026.1.0

Standard Standalone Installation? (y/n) If not then what?: Yes, standard standalone installation (as far as I know).

URL of experiment:

Do you want it to also run locally? (y/n): Yes.

What are you trying to achieve?:

I want to run a PsychoPy experiment online through Pavlovia and recruit participants via Prolific. My original experiment contains 16 trials, with video stimuli showing different emotions. Each trial randomly presents either the left or right version of a video.

However, I also created a completely new, minimal experiment without any videos to determine whether the issue was related to my stimuli. I still encountered problems, so I suspect that the issue may not be specific to video playback.

What did you try to make it work?:

  • Tried syncing the experiment with Pavlovia multiple times.

  • Checked that the Pavlovia repository is accessible and contains the experiment files.

  • Created a new, simple experiment without videos to test whether the original experiment’s complexity was causing the problem.

  • Tried running the experiment in the browser using Pilot in Browser.

  • Investigated the JavaScript code generated by PsychoPy and the Code components.

  • Encountered errors in the JavaScript tabs after using Python code in Code components with automatic translation enabled.

I have not yet established whether all synchronization attempts actually succeed.

Link to the most relevant existing thread you have found:

What specifically went wrong when you tried that?:

I have encountered several different errors during testing.

1. Synchronization error

When syncing with Pavlovia, I sometimes get this traceback:

wx._core.wxAssertionError: C++ assertion "m_buffer && m_buffer->IsOk()" failed at ..\..\src\common\dcbufcmn.cpp(149) in wxBufferedDC::UnMask(): invalid backing store

I do not know whether the synchronization fails completely or whether this error is related to PsychoPy’s graphical interface.

2. JavaScript syntax errors

I have also received alerts such as:

JavaScript Syntax Error in 'Begin JS Experiment' tab.
Line 1: Unexpected token

Similar errors occurred in the Before JS Experiment and Begin JS Routine tabs. Some of my Code components contain Python-specific imports, and I discovered that the automatically generated JavaScript was invalid.

3. Local browser test

When trying to run Pilot in Browser, Chrome sometimes displays:

ERR_EMPTY_RESPONSE

at localhost:12002/?_pilotToken=local.

4. Online video playback

In the original experiment, the online version also produced:

ReferenceError: video_file is not defined

The most confusing part is that a separate, simple experiment without videos also encounters problems. I therefore do not know whether these errors share a common cause or whether I am dealing with multiple independent issues.

How should I systematically diagnose these problems? In particular, how can I determine whether the wxBufferedDC error prevents synchronization, and how should I troubleshoot the JavaScript and local browser errors?

Thank you for your help!

Hello @lele

Thank you for the description. The errors probably do not share one cause. Two of them (the wx assertion and the local server problem) point to the environment, the other two (JavaScript syntax error and video_file) point to the experiment code. The fact that a simple experiment without videos also fails suggests that at least part of the problem is environmental. To separate the layers, I would proceed as follows:

1. Minimal test (decides environment vs. experiment)
Create a new experiment with one text routine, no code components, no loops, no video. Then try (a) Pilot in browser and (b) Sync with Pavlovia. If this already fails, the cause is the installation, network or account, not your experiment.

2. Does the wxBufferedDC error block synchronization?
This is a GUI drawing assertion in wxWidgets, usually not fatal. To test it:

  • Note exactly when it appears (at startup, when opening the sync dialog, or when clicking Sync).
  • Test whether the minimal experiment syncs despite the message.
  • Cross-check with Git outside PsychoPy: in the project folder run git status, git remote -v, git push. If the push works, Pavlovia and your credentials are fine and the error is only cosmetic. If it fails, the Git message (authentication, main vs. master, conflicts) shows the real cause.
  • Also try: display scaling at 100 %, single monitor, Builder window not minimized, and rename %APPDATA%\psychopy3 to reset the preferences.

3. JavaScript syntax error (“Unexpected token”)

  • The error in “Line 1: Unexpected token”.
  • Check the Begin JS Experiment tab of every code component. Typical culprits are Python syntax in the JS tab (#comments, import, True/False, Python dicts).
  • Compile to JS, open the generated .js file, and check the browser console (F12). Line numbers there refer to the generated file, not to the tab.
  • node --check file.js can also locate syntax errors.

4. ReferenceError: video_file is not defined

  • Is video_file defined only in a Python code tab? Then it does not exist in the JS version.
  • Does the column name in the conditions file match exactly (case, spaces)? Is the Movie component set to “set every repeat” with $video_file?
  • Are the video files in the experiment resources, preferably MP4/H.264?

5. ERR_EMPTY_RESPONSE on localhost:12002

  • Check the Runner output for a Python traceback when the error appears.
  • Close PsychoPy completely (a stale process may block the port) and restart.
  • Try another browser, and check firewall/antivirus.
  • Errors in the JS code (point 2, 3 and 4) can cause the page delivery to fail, which would explain the intermittent behavior.

6. What would help the forum helpers

  • Do you use the stand alone installation or the studio version of PsychoPy
  • The complete Runner output
  • The result of the minimal test and the Git check
  • The .psyexp file, or at least the code components and movie settings

You might want to consider updating to the latest version of PsychoPy.

Best wishes Jens

Thank you for your reply !

Someone helped me debug yesterday. One of the problems was that I had too many parasite files in my experiment folder on my pc, so we created a new folder with a copy of my experiment and it solved some of the bugs.

Then we corrected my javascript code, because the function I used (random) was not compatible with psychopy (from what I understood). We randomized with another method.

Thank you for your help !

Best regards