I use a “:put” command to debug, but it only works when the script is run from the command line. It won’t work with the scheduler. Try adding a couple lines like this:
:put "made it here";
I would put one of these immediately after each of those two statements and run it. See where it displays the “internal item number” error in relation to “made it here”.