James Thomas Green, Texas prisoner # 769383, appeals the district court’s dis*416missal of his 42 U.S.C. § 1983 complaint against all of the state court judges who have had jurisdiction over his litigation relating to his 1996 conviction for murdering his wife. The district court dismissed the complaint pursuant to 28 U.S.C. § 1915A(b)(l).
We review the dismissal of Green’s complaint under § 1915A(b)(1) de novo. Green v. Atkinson, 623 F.3d 278, 280 (5th Cir.2010). Because the defendants are entitled to absolute immunity from claims for damages arising out of acts performed in the exercise of their judicial functions, Green has not shown that the district court erred in dismissing his claims against them, and we affirm the judgment of the district court on this ground. See Berry v. Brady, 192 F.3d 504, 507 (5th Cir.1999); Boyd v. Biggers, 31 F.3d 279, 284 (5th Cir.1994).
According to Green, the district court misconstrued his claims and erroneously found them barred under Heck v. Humphrey, 512 U.S. 477, 486-87, 114 S.Ct. 2364, 129 L.Ed.2d 383 (1994). Because Green’s claims necessarily imply the invalidity of his murder conviction, which has not been set aside, they are not cognizable under § 1983. See Heck, 512 U.S. at 487, 114 S.Ct. 2364. Given that Green’s § 1983 claims are barred by Heck and all of the defendants named in his complaint are entitled to absolute judicial immunity, any error by the district court in dismissing the complaint without giving Green an opportunity to amend was harmless. See Bazrowx v. Scott, 136 F.3d 1053, 1054-55 (5th Cir.1998).
The district court’s dismissal of Green’s complaint for failure to state a claim counts as a strike for purposes of 28 U.S.C. § 1915(g). See Adepegba v. Hammons, 103 F.3d 383, 387-88 (5th Cir.1996). Green is warned that if he accumulates three strikes, he may not proceed in forma pauperis in any civil action or appeal filed while he is incarcerated or detained in any facility unless he is under imminent danger of serious physical injury. See § 1915(g).
AFFIRMED; SANCTION WARNING ISSUED.