In Eriline Company S.A. v. Johnson, the Fourth Circuit held in an opinion by Judge King, joined by Judges Williams and Gregory, that the District Court erred by raising sua sponte the bar of the statute of limitations as a basis for dismissal. The Court distinguished the rare circumstance of a habeas petition untimely on its face, as the exceptional case in which the district court can act on a limitations defense not raised by the parties. The Court also concluded that the limitations defense in the case did not go the court's subject matter jurisdiction.
Unrelated to the limitations issue, there was some interesting discussion about whether there was subject matter jurisdiction because as the case had developed, by the end there were non-diverse parties on both sides of the case. The Court concluded that it did not matter, the trial court had supplemental jurisdiction over the state law claims.