In an ethical legal environment, this would be considered a severe prejudicial “error” and the proper judicial remedy would be to dismiss all charges against the defendant and sanctions would be levied against the DA for a stunt like this.
I don’t think it should matter if it was a mishap. You just don’t let stuff like that happen.