I was able to recreate the error by loading 5 tifs, then I went to the edit menu and selected run assistant. After that finished, I went to the stitcher tab, and told it to stitch and it crashed.
Here’s the various ways that I ran it that were successful:
HIt the create control points button, then go to the stitcher tab and stitch. The last image didn’t align correctly, but it created the panorama and imported it.
Hit the create control points button, then the two optimize buttons, then go to the stitcher tab and stitch. That worked, but the image needed cropped afterwards.
Go to file -> save and save the project. Go to file -> Run Batch Processor. In Batch Processor go to file -> open and add the project to the assistant queue. Click the Automatic stitch after assistant checkbox. Select the project and run it. It completes, may say there is an error, but the image is fine.
In all the working cases, the image is imported back into darktable.
I didn’t try running the assistant, saving the project, then running the batch processor and adding the project to the stitch queue. I’m not sure what the difference is between running the assistant from the menu and from the batch processor, but it seems to be a hugin issue rather than a script issue.
Looked at the pto file after a failed attempt and the paths were correct in the file. Tried one more way, selecting edit -> add to assistant queue when hugin starts. That ran perfectly. Just make sure that automatically stitch after assistant is checked.
Hope this helps,