# "Experiment failed to load." While image pre-loading with jspsych

**URL:** <https://discourse.psychopy.org/t/experiment-failed-to-load-while-image-pre-loading-with-jspsych/18171>\
**Category:** jsPsych\
**Created:** [November 16, 2020, 6:17pm UTC](https://discourse.psychopy.org/t/experiment-failed-to-load-while-image-pre-loading-with-jspsych/18171 "2020-11-16T18:17:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![yarenkoca](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/yarenkoca/32/8230_2.png) [@yarenkoca](https://discourse.psychopy.org/u/yarenkoca)\
**Post date:** [November 16, 2020, 6:17pm UTC](https://discourse.psychopy.org/t/experiment-failed-to-load-while-image-pre-loading-with-jspsych/18171/1 "2020-11-16T18:17:34Z")

</div>

URL of experiment: [https://run.pavlovia.org/ricelab/exemplar-independent-recognition-ama](https://run.pavlovia.org/ricelab/exemplar-independent-recognition-ama) (PILOTING)

Description of the problem: A lot of the times when preloading images, it gives me an “Experiment failed to load.” error. Usually is fixed when the page is refreshed a few times, but sometimes even tens of refreshes don’t solve the problem. I saw this issue being addressed before but it’s been said that increasing the max preload time fixes this problem, but my max load is at 30k seconds right now. I don’t have any issues running it locally. I have several items to preload (around 500) but the items are not large in file size.

Here’s what I see in the console:

Uncaught TypeError: Cannot read property ‘style’ of null  
at update\_loading\_progress\_bar (jspsych.js:2559)  
at Image.img.onload (jspsych.js:2411)

266jspsych.js:2559 Uncaught TypeError: Cannot read property ‘style’ of null  
at update\_loading\_progress\_bar (jspsych.js:2559)  
at Image.img.onload (jspsych.js:2411)

Any help is appreciated. Please let me know if there is any further information that you need.

---

<div class="post-metadata">

**Author:** ![thomas\_pronk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/thomas_pronk/32/9531_2.png) [@thomas\_pronk](https://discourse.psychopy.org/u/thomas_pronk)\
**Post date:** [November 18, 2020, 1:08pm UTC](https://discourse.psychopy.org/t/experiment-failed-to-load-while-image-pre-loading-with-jspsych/18171/2 "2020-11-18T13:08:11Z")

</div>

Hi yarenkoca,

I tried to run your experiment in Chrome, but at one point it said “failed to load”. In the network tab of the developer tools I noticed that pictures were still being downloaded while this message appeared, and after a while they were all properly downloaded.

My hunch is that some timeout occurs on the side of jsPsych; you could examine whether some plugin could be adjusted for longer download durations. Another option is changing your BMP stimuli to JPG, so they are smaller and get downloaded quicker.

Best, Thomas

---

<div class="post-metadata">

**Author:** ![thomas\_pronk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/thomas_pronk/32/9531_2.png) [@thomas\_pronk](https://discourse.psychopy.org/u/thomas_pronk)\
**Post date:** [November 22, 2020, 8:46pm UTC](https://discourse.psychopy.org/t/experiment-failed-to-load-while-image-pre-loading-with-jspsych/18171/3 "2020-11-22T20:46:28Z")

</div>

Hey @yarenkoca,

I saw you posted you question in the jsPsych Google Group. They moved their Q&A to this site: [https://github.com/jspsych/jsPsych/discussions](https://github.com/jspsych/jsPsych/discussions)

Cheers T

---

<div class="post-metadata">

**Author:** ![yarenkoca](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/yarenkoca/32/8230_2.png) [@yarenkoca](https://discourse.psychopy.org/u/yarenkoca)\
**Post date:** [November 25, 2020, 12:49am UTC](https://discourse.psychopy.org/t/experiment-failed-to-load-while-image-pre-loading-with-jspsych/18171/4 "2020-11-25T00:49:31Z")

</div>

Thank you so much for letting me know! Highly appreciated.

---

<div class="post-metadata">

**Author:** ![yarenkoca](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/yarenkoca/32/8230_2.png) [@yarenkoca](https://discourse.psychopy.org/u/yarenkoca)\
**Post date:** [November 30, 2020, 2:18am UTC](https://discourse.psychopy.org/t/experiment-failed-to-load-while-image-pre-loading-with-jspsych/18171/5 "2020-11-30T02:18:58Z")

</div>

I tried this just now, and it seemed to have helped greatly! The error only occurred once after I changed the file types. I hope it can be completely fixed soon, but this might be a workaround for now.

Thank you!
