Well, apparently, you have hit something incredibly rare.
Due to storage limitations in the game's code, the Master Ball can sometimes fail, believe it or not! But it's an incredibly rare chance that that would happen. How rare, you may ask? Just a 1 in 65,355 or 0.0015%. That is 8 times the chance of finding a shiny Pokemon. Amazingly, you beat the odds of even finding a Shiny - eight shinies to be exact.
As much as it's sad that you wasted your Master Ball, I'd say well done on hitting this drastic chance! xD