I don't know the circumstances, but occasionally judges toss trivial things to punish DAs for messing up. It rarely impacts cases with larger punishments. You're likely referring to a misdemeanor case where the defendant may have gotten a plea deal for 6 months and had a good job and time in jail would have messed that up and resulted in a waste of county resources. Also, things like this occasionally happen to create the illusion of legitimacy. I am not sure if this is a case you read or if you witnessed the judge's ruling, but the fact that you're using what is likely a case that carries less than 365 days max time as an example of how a judge will destroy a DAs entire case is in itself revealing.
Have any circuit court examples of cases carrying 10 years? 20 years? Life? No? Oh, I wonder why. Are you a clerk? Assisting an ADA? You're completely biased and want to see things working. Go read about how impossible it is for the harmless error rule to get overcome on appeal, go read about how structural errors are essentially ignored or the remedy isn't even release but just go back to start. There's plenty of articles about this.
https://harvardlawreview.org/print/vol-131/harmless-errors-and-substantial-rights/
I also once saw someone steal a soda from a store and was going to get a month in jail but the judge tossed the entire case because the DA made a procedural error! The system must work!