Builder becomes unresponsive when inserting a new loop or routine

OS (e.g. Win10): Linux Mint
PsychoPy version (e.g. 2024.2.4 Py 3.8): PsychoPy Studio 2026.1.1 appimage
Standard Standalone Installation? (y/n) y
Do you want it to also run online? (y/n) y
What are you trying to achieve?: add more routines and loops to my flow without the builder becoming unresponsive. I only have 6 routines and 2 loops currently.

What did you try to make it work?: Making sure it was running on my NVIDIA GPU instead of my Intel CPU’s integrated graphics, restarting PC, restarting PsychoPy, I reproduced the error in a fresh experiment by just adding ~8 empty routines to the flow

Link to the most relevant existing thread you have found: link

What specifically went wrong when you tried that?: I couldn’t find any informative logs or error messages. The builder just becomes unresponsive. Sometimes it incorporates the new routine/loop but messes up the rest of the flow and then becomes unresponsive (e.g., I click “Add Loop”, I click on one dot to place it, and right then the other two loops in the flow suddenly get messed up and the whole builder becomes unresponsive)

Here are the necessary files to run it in case it’s helpful.

consequential_5g5d4h_wtf2.psyexp (174.7 KB)

conditions.csv (1.3 KB)

Here’s the original flow:

Here I try to make a loop around the first routine in the flow and then the whole Flow gets messed up and the Builder becomes unresponsive:

Any help would be immensely appreciated!

So I was able to open the experiment and add routines and loops in Windows. Something I noticed is that in the Windows version there are horizontal and vertical scroll bars which are necessary to view larger Flows. These are absent in the Linux version so I’m thinking there might be a graphical issue in rendering the Flow.

If (before it freezes up) you press CTRL+SHIFT+I you can open the browser console and there’ll be a message saying “Loop Terminator found with no matching Loop Initiator”, so I think there’s a flaw in the logic when Builder processes elements in the flow.

If I make a new experiment and start adding loops I can’t get it to fail the same way, so there’s something specific about the structure of this experiment. Thanks for sharing this, it’s really helpful having a file I can open which reliably causes a bug! Hopefully I can use this to track down the actual cause.

Ah, I think I’ve found it… When going through the flow and converting it to a layered structure rather than the flat list it’s saved as in the .psyexp, the logic we use to match loop starts to loop ends fails when there’s a loop start (from the loop you’ve just made) and multiple layers of loop ends (from pre-existing nested loops) as it matches the ends to the wrong starts and ends up with one too many ends, which isn’t supposed to be possible, so we get this error and the interface freezes up.

I believe this should fix it (it does when I open your experiment and make loops, at least), so keep an eye out for the next release: BF: Fix bug matching loop initiators to loop terminators in Builder flow by TEParsons · Pull Request #59 · psychopy/psychopy-studio · GitHub

As a temporary workaround, you can add a loop at the root level (e.g. either side of initialize_task_variables), and then move it by dragging the arrows into the position you want.

1 Like

Thank you so much for your time and effort! I’ve already moved the experiment over to a Windows machine and there it seems to work fine. I look forward to the next Linux release! Regarding the temporary workaround, it doesn’t work for me. What you mentioned is exactly what I tried to do in the screenshots. I know it doesn’t appear that way, but all I did between the first and second screenshot was: click add loop, click the dot to place it after initialize task variables. Then it glitched out and put the loop around initialize_task_variables and messed up the placements of the preexisting loops as well. I also want to add that the UI becomes unresponsive if I add routines before or after initialize_task_variables. It does, however, let me add a routine at the end of the flow, for example.

Your changes fixed the problem. The PsychoPy Studio 2026.1.2 Linux release allows me to add more routines and loops. Thank you!

@TParsons I continued development of the task and things were working but now I’m getting a similar error:

The error occurred right after attempting to add a routine at the red dot. In case it’s relevant, I made a copy of the fixation_demo1 routine, clicked hamburger menu > experiment > “paste routine”, then clicked “Add Routine” and then the error occurred when I tried to insert the routine after init_trial_vars_demo2.

consequential.psyexp (416.2 KB)

Thank you so much for your help.

Thanks for sharing the experiment, I’ll try to recreate it :slight_smile: My first guess is that pasted Routines aren’t being properly associated with an experiment, so at the first occasion where it’s looking for the attribute .flow on the Routine’s .experiment attribute it’s hitting this error because .experiment is undefined.

1 Like

Thank you so much. You might be right with respect that that specific error, but I’m having problems when inserting new routines and loops as well. Here is an example of an error I get after adding a loop around the initialize_task_variables routine and then attempting to delete the loop:

consequential.psyexp (416.2 KB)

The psyexp file I shared is not in the exact same state where I ran into all of these bugs (I would have to fish for each bug individually and upload the exact experiment file associated with each one which I’d be happy to do if I had a bit more time, my apologies) but it’s at least in a very similar state to where I’ve run into the following errors: builder unresponsive after adding new routine (copied or new), builder unresponsive after adding loop, builder unresponsive after deleting loop.

I’ve been continuing development on a Windows machine and everything works there.

Ah, that one is a different bug; looks like I wrote logging.error when I meant console.error for one warning. Thankfully it’s easy to track down and change so I’ll get a fix in for that ASAP.

The warning it was on is just alerting you that it couldn’t set a devices file, which is usually the case if you’ve got an older version set in Use Version in Experiment Settings (as pre-device-manager versions obviously don’t have a method for pointing to a device manager file, so this should be an ignorable warning but because of a typo it becomes a fully fledged error).

1 Like

In case it’s useful: I haven’t been able to reproduce the errors when adding new routines and loops. I have, however, reproduced the error when adding a copied routine to the flow.