Okay, here's what I've got so far. Using the image files you provided:
(1) I am *not* able to reproduce the issue with the script version you initially provided (attached here:
https://www.millisecond.com/forums/FindPost15727.aspx ).
(2) I am able to reproduce the issue using the script included in the ZIP archive (attached here:
https://www.millisecond.com/forums/FindPost15745.aspx ).
(3) As far as I can tell, the issue is *not* caused by either <trial initialselect> or <trial reselecttrial>. It is <trial patchtrial>'s setup.
(3a) In the latest script version (under #2 above), you insert a <clock> element into <trial patchtrial>'s frames
/ontrialbegin = [if (...)
{trial.patchtrial.insertstimulusframe(clock.choose, 1); ...}
...
while you already have that <clock> in the trial's regular /stimulusframes attribute:
/stimulusframes = [1 = choose]
This is what causes the crash for me. You can provoke the same behavior by foregoing insertstimulusframe() and simply doing
/stimulusframes = [1 = choose, choose]
(3b) With that said, removing the redundant clock insertion-logic from the /ontrialbegin attributes resolves the issue for me. The script then runs as expected. A file with those modifications is attached to this response and I'd be interested to learn how that script behaves on your system.