Why did mechanical units explode when being fixed by SCVs in Starcraft 2?

To repair a mechanical unit with an SCV, right click on the unit with the SCV selected, or select 'Repair' from the menu on the bottom right. You can also press 'R' then click on the unit you want to repair.

If you accidentally press 'A' then click on a friendly unit, your SCV will start attacking the unit and dealing damage, causing them to explode when they run out of HP.

enter image description here