TypeError: Converting circular structure to JSON (...)

URL of experiment: Here I attempt to share my code since the task is still in piloting mode, I hope you can access it: https://gitlab.pavlovia.org/sxc1127/cued-task-switching/blob/master/html/sara_task_switch_beh_psychopy.js

Description of the problem:
My task has a training part and a main experiment part which are very similar in structure. The training phase works ok, but then I get the following error at the beginning of the main experiment loop (‘main_exp_loop’)

TypeError: Converting circular structure to JSON --> starting at object with constructor ‘PsychoJS’ | property ‘_logger’ -> object with constructor ‘Logger’ — property ‘_psychoJS’ closes the circle

Any idea why? The task works fine when tested locally from PsychoPy, but gives me this problem when I pilot it online with Pavlovia.

Many thanks for your help!

Dear @SaraCal thanks for flagging, because the gitlab project you link to is no longer active, would it be possible to share a code snippet for me to investigate further if I can? Thanks


many thanks for your help. Please find my psyexp code attached here - let me know if you need more information.

sara_task_switch_beh_psychopy.psyexp (211.4 KB)

@SaraCal No problem, I’ll be on this first thing tomorrow, thanks

Hi @SaraCal, thanks again for sending over the .psyexp file. We are trying to get this fixed, would it please be possible to also give us a sample “psychopy_LIST” .xlsx file? Thanks

Hi @sotiri,

sure, you can find it here below (I also attached the file for the training phase just in case):

p1_psychopy_LIST.xlsx (21.1 KB) p1_psychopy_TRlist.xlsx (5.6 KB)

Thank you very much!

OK great that’s really helpful, many thanks for your patience while I investigate further

Hi @SaraCal,

It seems like passing in the names of ‘cue1’ and ‘cue2’ when setting opacity for the rest of your stimuli inside of ‘fixation_cueRoutineBegin’ is causing the error.

Could you please try passing in numeric values instead? If your intention is for eg. ‘cue1a_main’ to have the same opacity as ‘cue1’ as a result, you should be able to just use ‘cue1.opacity’ I believe.

I hope that solves the problem, here to help if not.


Thank you very much for your help, I just changed the name of those variables and it works now!