Here is another very detailed description on how to handle the potential problem: https://www.tira.io/t/tira-submission-fails-with-http-500-after-successful-smoketest-image-upload.
(symptoms and solutions described in a different way, so this might be very helpful.)