I think this is a bug (and not a deliberate decision), but if you are repairing an item and you have a number of hitpoints equal to a multiple of how much it removes per tick, it can kill you. For example, if you are repairing something broken and it takes 7 energy per tick, you will die if you have 14 energy, but not if you have 13. When it does the check "energy >= per_tick_removed" it shouldn't allow equality.