Burned flipsky vesc, bldc and bms

Hi, I would like to ask for help in locating the fault that results in burned bldc (sk3 6374) , vesc (flipsky 4.12) and bms (bestech) . A few days ago on the way home, constant speed, my board suddenly braked and fired me like a catapult. When I got up and walked to the board, no response to remote. Bldc resisted clearly. After a few seconds smoke started coming out and and stoped few seconds later. When I opened the enclosure almost everything was burned apart from the battery and receiver. At the moment, bms smell and always gives current - the switch does not work.
I noticed then that the balance connector was a little bit loose (possible cause?).

Then vesc has burnt drv and a loose cable from the capacitors loose (heatshrink melted along the entire length of the cable). During the extraction, I noticed that one of the vesc - motor cables was loose (possible cause). Was soldered over half a year ago and never caused problems. I know that full braking can occur with connection problems but could it burn everything? Bldc I did the A + B, B + C, A + C test. When the connection of all three wires together gives proper resistance, when I have them separated it gives a “different” resistance and each combination with wire B does not work. The winding in the motor is additionally covered with resin and despite the appearance of burns (resin and dust) underneath is pure copper. The battery was the only one left unscathed. Gives correct voltage from the cells. My setting was Motor max 50, batt max 40,