Exactly.
The reason for the mistrial is that, as Texas case law says, “There is no trial by ambush in Texas.” Also, CCP 2.21 says that the job of the prosecutor is not to convict, but to ensure justice is done.
Stupidity or ambitious arrogance by the prosecutor, wanting a notch in his belt for promotion/election as DA. Having been a prosecutor, that’s something that requires constant vigilance.