Isn’t there something called “malicious prosecution” or something like that?
A Brady violation. As in Brady v Maryland. It requires the prosecution to turn over materially exculpatory evidence in its possession.
Almost impossible to prove.
In addition, about 1976, The Supreme Court created absolute immunity for prosecutors out of thin air.