# Online experiment crashes - can't find my trials variable?

**URL:** https://discourse.psychopy.org/t/online-experiment-crashes-cant-find-my-trials-variable/34302
**Category:** Online experiments
**Tags:** pavlovia
**Created:** [April 7, 2023, 11:57pm UTC](https://discourse.psychopy.org/t/online-experiment-crashes-cant-find-my-trials-variable/34302 "2023-04-07T23:57:45Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![camila\_maura](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/camila_maura/32/37301_2.png) [@camila\_maura](https://discourse.psychopy.org/u/camila_maura)
#### Post date: [April 7, 2023, 11:57pm UTC](https://discourse.psychopy.org/t/online-experiment-crashes-cant-find-my-trials-variable/34302/1 "2023-04-07T23:57:45Z")

</div>

URL of experiment: [Pavlovia](https://pavlovia.org/nutellarocknroll/attempt_1)

Description of the problem: My experiment gets stuck before my loop begins, and I get the following error:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/5/4/54e656498a179d57a943511507addb70aa529d3b.png)  
it seems like the plaform is being unable to find the trial variable of my loop?. This has never happened to me before, I’m really stuck.

---

<div class="post-metadata">

### Author: ![Chen](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/chen/32/38825_2.png) [@Chen](https://discourse.psychopy.org/u/Chen)
#### Post date: [April 8, 2023, 12:49pm UTC](https://discourse.psychopy.org/t/online-experiment-crashes-cant-find-my-trials-variable/34302/2 "2023-04-08T12:49:35Z")

</div>

Hello,  
Did you change the code since posting it here?  
I receive a different error, so I want to make sure we are on the same page:  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/4/c/4c88b1111942c1dcf5bbe00c7bd57aadd9d8f282.png)

---

<div class="post-metadata">

### Author: ![camila\_maura](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/camila_maura/32/37301_2.png) [@camila\_maura](https://discourse.psychopy.org/u/camila_maura)
#### Post date: [April 8, 2023, 1:04pm UTC](https://discourse.psychopy.org/t/online-experiment-crashes-cant-find-my-trials-variable/34302/3 "2023-04-08T13:04:44Z")

</div>

Hi!

Thank you very much for checking.

Actually no, I haven’t changed the code. I tried to run it right now and I keep getting the same error I described above:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/9/0/9085e7c189a16e8bc51306afd852f17379536cfa.png)

I don’t think I’ve encountered the error you are showing yet, ugh ☹

---

<div class="post-metadata">

### Author: ![Chen](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/chen/32/38825_2.png) [@Chen](https://discourse.psychopy.org/u/Chen)
#### Post date: [April 8, 2023, 3:01pm UTC](https://discourse.psychopy.org/t/online-experiment-crashes-cant-find-my-trials-variable/34302/4 "2023-04-08T15:01:06Z")

</div>

If I understand correctly, the experiment works fine online, but the problem shows only offline, right?

Looking at your Javascript code, you are using `list()` the same way as in Python. For example:

```javascript
if ((! (population instanceof list))) {
    population = list(population);
}

```

But `list` is not a javascript object/method. I can see the usage of the list 23 times in your code, so you need to fix it to make it work online.

About the error you received, I am not sure what is causing it.  
Did you try updating PsychoPy to the newest version? Because it works on my machine (v2022.2.5)

---

<div class="post-metadata">

### Author: ![camila\_maura](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/camila_maura/32/37301_2.png) [@camila\_maura](https://discourse.psychopy.org/u/camila_maura)
#### Post date: [April 8, 2023, 3:25pm UTC](https://discourse.psychopy.org/t/online-experiment-crashes-cant-find-my-trials-variable/34302/5 "2023-04-08T15:25:37Z")

</div>

Hi!

It’s actually quite the opposite: it works perfectly offline but breaks online. I have the latest version of Psychopy (v2023.1.1).

I do use a lot of code componente involving lists. I thought the conversion to JS was done automatically in the builder.

It’s odd that you’re getting a different error than me. I will check how lists work in JS and get to it, but sadly I believe this doesn’t solve my issue with the trials ☹

---

<div class="post-metadata">

### Author: ![Chen](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/chen/32/38825_2.png) [@Chen](https://discourse.psychopy.org/u/Chen)
#### Post date: [April 8, 2023, 3:46pm UTC](https://discourse.psychopy.org/t/online-experiment-crashes-cant-find-my-trials-variable/34302/6 "2023-04-08T15:46:34Z")

</div>

I meant the opposite. It works fine offline and doesn’t work online 😅  
Maybe someone else has more experience with it and can give a different perspective. I’m not sure why you are getting this error…

---

<div class="post-metadata">

### Author: ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)
#### Post date: [April 9, 2023, 6:00pm UTC](https://discourse.psychopy.org/t/online-experiment-crashes-cant-find-my-trials-variable/34302/7 "2023-04-09T18:00:40Z")

</div>

Do you have concentric loops?

If so, go to Experiment Settings and try changing the use version to 2022.2.5

---

<div class="post-metadata">

### Author: ![camila\_maura](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/camila_maura/32/37301_2.png) [@camila\_maura](https://discourse.psychopy.org/u/camila_maura)
#### Post date: [April 16, 2023, 2:09am UTC](https://discourse.psychopy.org/t/online-experiment-crashes-cant-find-my-trials-variable/34302/8 "2023-04-16T02:09:38Z")

</div>

Hi!

As @wakecarter suggested, I changed from v2023 to v2022.2.5. When I did that, I started getting the lists error @Chen mentioned.

I solved that by reading how to properly manage lists in JavaScript (chat gpt \<3 ) and now my experiment is running smoothly 😺

Thank you very much @Chen and @wakecarter!!!
