In this retaliatory discharge case, the pro se plaintiff appeals from the district court’s sua sponte dismissal of his complaint for lack of subject matter jurisdiction. We vacate the judgment and remand the case to the district court for further proceedings.
BACKGROUND
Plaintiff filed a hand-written complaint alleging, in essence, that defendant Amtrak discharged him in retaliation for complaining to the department of transportation about an unsafe crossing gate. In his complaint, plaintiff alleged that the district court had jurisdiction under 28 U.S.C. § 1332 (diversity jurisdiction) but also alleged that both he and Amtrak are “residents” of Massachusetts.
In reviewing the complaint in the course of allowing plaintiffs application to proceed in forma pauperis, the district court determined, sua sponte, that “there is no diversity of citizenship, and the Complaint discloses no other basis for the exercise of federal jurisdiction.” For that reason, the court dismissed the case “without prejudice” and directed that “^judgment may be entered accordingly.” Id. The same day, the clerk entered judgment dismissing the complaint, but “with prejudice.” This appeal followed. Br. Add. 3.
DISCUSSION
As we have previously warned, “[cjourts must move cautiously when dismissing a complaint sua sponte.” Clorox Co. Puerto Rico v. Proctor & Gamble Commercial Co., 228 F.3d 24, 30 (1st Cir.2000). Although “a district court may, in appropriate circumstances, note the inadequacy of the complaint and, on its own initiative, dismiss the complaint, ... a court may not do so without at least giving plaintiffs notice of the proposed action and affording them an opportunity to address the issue.” Literature, Inc. v. Quinn, 482 F.2d 372, 374 (1st Cir.1973) (dicta). While this rule has exceptions, none is applicable here.
Although district courts are required to dismiss an action “[wjhenever it appears by suggestion of the parties or otherwise that the court lacks jurisdiction of the subject matter,” Fed.R.Civ.P. 12(h)(3), “[defective allegations of jurisdiction may be amended,” 28 U.S.C. § 1653; and such amendments may be made without leave of court, where, as here, no responsive pleading has been filed. Fed. R.Civ.P. 15(a). By dismissing plaintiffs complaint, sua sponte, without giving him prior notice of the defect in his jurisdictional allegation, the district court deprived the plaintiff of his right to amend the complaint to cure the defect. The clerk then compounded the problem by entering judgment with prejudice — rather than without prejudice as the court directed and as is appropriate for dismissals on jurisdictional grounds, 2 Moore’s Fed. Prac.3d § 12.30[2] at 12-36 — thereby precluding plaintiff from correcting his error by filing a new action.
Nor does plaintiffs in forma pauperis status afford a basis for this dismissal. Sua sponte dismissals of in forma pauperis complaints are authorized only where “the court determines that ... the action ... (i) is frivolous or malicious; (ii) fails to state a claim on which relief may be granted; or (iii) seeks monetary relief against a defendant who is immune from such relief.” 28 U.S.C. 1915(e)(2)(B). None of those determinations was made here, nor does it appear that any such determinations would have been warranted on the face of the complaint. See Fredyma v. AT & T Network Sys., Inc., 935 F.2d 368, 368 (1st Cir.1991) (per curiam) (explaining that, under § 1915(e), “a sua sponte dis*81missal without notice ... is appropriate only if a claim is premised upon ‘an indisputably meritless legal theory’ or ‘factual allegations [that] are clearly baseless.’ ”) (citing Neitzke v. Williams, 490 U.S. 319, 325, 327, 109 S.Ct. 1827, 104 L.Ed.2d 338 (1989)).
Accordingly, the judgment of dismissal is vacated and the case is remanded to the district court for further proceedings.