Almost got hurt today. PSA

I assume you are saying this is a 20A cord based on the plug?

The specs say that the machine will pull 21A on single phase 120VAC, or 22A on 220VAC, if in the highest current mode (lowest duty cycle). (I don't see a 40A input current rating anywhere in the specs you provided.....???) So it looks like they are counting on your observing the duty cycle limits and current limits to make the cord survive.

I suspect post #10 is correct: the individual wire insulation inside the cord started to melt, either due to a fault or to excess duty cycle use, and you grabbed it in a way that moved the wires into direct contact.

BTW, running this on a 50A circuit is a problem. Breakers do not trip instantly at 1 A over current. They usually have both a thermal and a magnetic trip mechanism. The thermal is for long term mild overloads and the magnetic is for quick, very high overloads. You're not even close to tripping the thermal mechanism with this load. So only the magnetic portion would have helped here, but the magnetic trip rating is many times the faceplate rating on the breaker, so the cord's short circuit blew before the 150-200A magnetic trip rating of the breaker. It is not the right breaker rating for this load. Your buddy needs to put this on a 30A breaker IMHO; this looks like an inverter machine, so should not have a high overcurrent peaks like an old buzz box.