Coram nobis or coram vobis also known as error coram nobis or error coram vobis (from Latin quae coram nobis resident, or quae coram vobis resident, "which [things] remain in our presence", or "in your presence", respectively: the "things" referred to are the records of the original case.) is a legal writ issued by a court to correct a previous error "of the most fundamental character" to "achieve justice" where "no other remedy" is available. A petition for writ of error coram nobis is generally brought before the trial court, while a petition for writ of error coram vobis is brought before an appellate court. Both coram nobis and coram vobis differ from habeas corpus in that they do not have a custody requirement.
A coram nobis petition applies to persons who have already been convicted of a crime and have served their sentence. It may seek to remove probation requirements or restrictions, eliminate payment or obtain refund of court imposed fines, restore voting rights and gun ownership, improve employment and credit potential, remove a public stigma, and so forth, in order to restore, so far as possible, the erroneously convicted party to a pre-conviction state. Motions may be filed by heirs at law even after the convicted person is deceased.
In a case from 2007 (Gary Earl Neighbors v. Commonwealth of Virginia), the Supreme Court of Virginia explained in great detail the purpose of a writ of error coram nobis, quoting from a 1957 decision from the same court (Dobie v. Commonwealth):
- The writ of error coram vobis, or coram nobis, is an ancient writ of the English common law. It was called coram nobis (before us) in King’s Bench because the king was supposed to preside in person in that court. It was called coram vobis (before you — the king’s justices) in Common Pleas, where the king was not supposed to preside. The difference related only to the form appropriate to each court and the distinction disappeared in this country when the need for it ended. 49 C.J.S., Judgments, § 311, p. 561, n. 28. Mr. Minor says the proper designation here is coram vobis. IV Minor's Inst., 3 ed., Part I, pp. 1052-3.
- The principal function of the writ is to afford to the court in which an action was tried in an opportunity to correct its own record with reference to a vital fact not known when the judgment was rendered, and which could not have been presented by a motion for a new trial, appeal or other existing statutory proceeding. Black's Law Dict., 3 ed., p. 1861; 24 C.J.S., Criminal Law, § 1606 b., p. 145; Ford v. Commonwealth, 312 Ky. 718, 229 S.W.2d 470. It lies for an error of fact not apparent on the record, not attributable to the applicant’s negligence, and which if known by the court would have prevented rendition of the judgment. It does not lie for newly-discovered evidence or newly-arising facts, or facts adjudicated on the trial. It is not available where advantage could have been taken of the alleged error at the trial, as where the facts complained of were known before or at the trial, or where at the trial the accused or his attorney knew of the existence of such facts but failed to present them. 24 C.J.S., Criminal Law, § 1606 at p. 148; 49 C.J.S., Judgments, § 312 c., pp. 563, 567. 
State courts may treat the writ very differently from their federal counterparts. The Supreme Court of California ruled in 2009 that the state petition for writ of error coram nobis cannot be used to challenge an old conviction that later forms the basis for deportation. For challenges to convictions, either at trial or in a plea bargain, that have deportation as a collateral consequence, California courts require a petition for Writ of Habeas Corpus.  The Court observed that "The writ of error coram nobis is a nonstatutory, common law remedy whose origins trace back to an era in England in which appeals and new trial motions were unknown."  The Court noted how limited the writ is in California, and expressly declared federal coram nobis law to be inapplicable.  In California, coram nobis essentially requires a fact, not going to the facts of the case (e.g. guilt or innocence) that would have prevented the rendition of the judgment.
Writs of coram nobis cannot be used to address issues of law previously ruled upon by the court but only to address errors of fact that were not known by the defendant at time of trial or plea bargain, and were knowingly withheld during and after trial or plea agreement from judges and defendants by prosecutors; and which might have altered the verdict were they presented at the trial; or in the case of a plea agreement, where the defendant would not have agreed to the plea had he been made aware of the unknown fact.
An example would be a circumstance such as a defendant agrees to a plea agreement but the fact that the resulting conviction will have a direct consequence, such as lifetime registration as a sex offender, has been withheld from the defendant. Obviously, the prosecutor is aware of such a thing, and defendant's attorney should certainly also be aware. Where this fact is withheld from the defendant, he is now prejudiced in that had he known the fact of lifetime registration he would not have pleaded guilty. The writ of coram nobis can be used to overturn such a plea agreement. If the defendant is still in custody however, he would petition for relief under habeas corpus.
Writ abolished in civil cases
In United States federal courts, the Federal Rules of Civil Procedure, under rule 60 (e) abolished the writ of coram nobis in civil cases. However, in United States v. Morgan, the Supreme Court held that coram nobis was still available in federal court for criminal cases. The explanation of this provision is speculative.
One relatively well-known example was in regard to the Supreme Court case Korematsu v. United States (1944), which upheld a conviction pertaining to the World War II Japanese American internment. In 1984, a federal district court judge granted a writ of coram nobis, overturning the conviction.
In another case, Alger Hiss, convicted in 1950 on two counts of perjury for lying under oath about having spied for the Soviet Union in the 1930s, filed for a writ of coram nobis in the 1970s, after the FBI released certain records that Hiss argued showed that he had not received a fair trial (and after Richard Nixon, a leading voice against Hiss on the House Committee on Un-American Activities, was disgraced by the Watergate scandal). A federal district court denied the petition, holding that the documents "raise no real question whatsoever, let alone a reasonable doubt, as to Hiss's guilt," that "[t]he trial was a fair one by any standard," and that "[t]he jury verdict rendered in 1950 was amply supported by the evidence — the most damaging aspects of which were admitted by Hiss." 
- Blackstone, Commentaries, New York, 1827, vol. ii, p. 314
- Bonadonna v. Unknown Defendant, 181 Fed. Appx. 819 (C.A. 11 (Ga.), 2006).
- Neighbors v. Commonwealth, 274 Va. 503. , citing Dobie v. Commonwealth, 198 Va. 762, 768-69 (1957).
- People v. Kim, 45 Cal.4th 1078.
- Cornell Law School website
- US legal definitions website
- Korematsu v. United States, 584 F. Supp. 1406 (N.D. Cal. 1984).
- In re Hiss, 542 F.Supp. 973, 999 (S.D.N.Y. 1978). , affirmed 722 F.2d 727 (2d Cir. 1983). , cert. denied 464 U.S. 890 (1983). .