The owner took the car to an official emission / noise testing facility, where it failed on noise. He was expecting to pass the noise test, which would be evidence to have the court dismiss the ticket, but instead it caused the car to be flagged in the system.
That is the logic behind the "must write ticket" rule. The police have to have a real reason to pull over a car. There's no such thing as a "routine traffic stop." That phrase appearing in the news is the press helping the police legitimize pretext stops.is often used as an abuse to get more out of the stop including searches etc.