Online experiment TypeError: Cannot read property '0' of undefined

Hello everyone,

URL of experiment:

Description of the problem:
I am trying to build an online experiment. When trying to run the experiment from I get the following error:

Unfortunately we encountered the following error:

** TypeError: Cannot read property ‘0’ of undefined*

Try to run the experiment again. If the error persists, contact the experiment designer.

Could anybody help me to see what is causing this error? Can we find out what ‘undefined’ means so we know where to solve the error?

Kind regards and thanks in advance,

Tirza Smits

Hi! I think it may be because some of your Image components (‘instructions’ and ‘definitions’) don’t have a size (in the javascript code of the online experiment their sizes are being initialized as undefined). Did you leave the size field empty when creating the experiment in Builder?

Similar question here:

Hello Nahuel thank you for your reply. Unfortunately I already tried to add a size to all the images. Could there be any other information missing? The experiment works fine in builder.
Thank you very much!

They do not have a size specified in the javascript code of the experiment you linked, maybe you didn’t recompile (File->Export HTML) or sync with Pavlovia after specifying a size for each image?

Thank you @Nahuel. I did sync the project. Does it matter what setting I use for side (e.g. from exp settings, cm, pix etc.).

I don’t think the size units matter for it to work (not sure if deg and cm are supported for online experiments though). You can see how different units work here. I think the default in exp settings (File->Preferences->General->Units) is norm, but often height or pix are more convenient.

Hello @Nahuel, I set a size for all the pictures (in pix) and it worked! Thank you very much for your help. The topic may be closed. Have a nice day.

1 Like