When a star is torn apart by a black hole or neutron star, the star doesn't lose any mass but fragments are created, which leads to the star gaining mass as it collides with the fragments, and eventually going supernova once they hit a few solar masses. This is quite a frustrating bug and only seems to happen with stars(not brown dwarfs)