Upload a file into HubSpot via the API is stuck from time to time
I am not familiar with uploading files into Hubspot. I'd say it could be a resource thing on the machine you're running the script; perhaps there's not enough resources available to finish the operation. It could also be a hiccup in the connection to Hubspot, killing the operation during transit. Those are my guesses without knowing more about uploading into Hubspot and the fact that it seems to be a random occurance.