Appeal from the Circuit Court of Lake County. No. 01--CF--2049. Honorable Victoria A. Rossetti, Judge, Presiding.
 The opinion of the court was delivered by: Justice Kapala
 Defendant, Joseph J. Murray, appeals the dismissal of his petition pursuant to the Post-Conviction Hearing Act (the Act) (725 ILCS 5/122--1 et seq. (West 2002)). He contends that the trial court improperly dismissed the petition on the ground of res judicata. We reverse and remand.
 After a jury trial, defendant was convicted of escape (720 ILCS 5/31--6(c) (West 2000)) and sentenced to 14 years' imprisonment. He appealed, contending that he was deprived of his right to represent himself at trial. This court affirmed. People v. Murray, No. 2--01--1480 (2002) (unpublished order pursuant to Supreme Court Rule 23).
 Defendant then filed a post-conviction petition in which he contended that "the trial court improperly deprived [him] of the right of self representation." The trial court dismissed the petition, finding that res judicata barred defendant from raising this claim. Defendant timely appeals.
 Defendant contends that the trial court could not dismiss his petition on the ground of res judicata at the first stage of post-conviction review. We agree.
 Under the Act, a post-conviction proceeding not involving the death penalty has three stages. People v. Boclair, 202 Ill. 2d 89, 99 (2002). At the first stage, the trial court must examine the petition within 90 days. The court shall dismiss the petition if it "determines the petition is frivolous or is patently without merit." 725 ILCS 5/122--2.1(a)(2) (West 2002). We review de novo the dismissal of a petition at the first stage. People v. Coleman, 183 Ill. 2d 366, 387-88 (1998).
 In Boclair, our supreme court held that a court could not dismiss a petition at the first stage on the ground that it was not filed within the time limit specified in the Act. Boclair, 202 Ill. 2d at 100-01. The court explained that the Act's time limitation is in the nature of an affirmative defense that can be raised, waived, or forfeited by the State. Boclair, 202 Ill. 2d at 101. Therefore, the State should have to raise such a claim in a responsive pleading and the defendant would then have a chance to respond to the State's allegations.
 This court has subsequently held that waiver, like untimeliness, may not be the basis of a first-stage dismissal. People v. Cleveland, 342 Ill. App. 3d 912, 915 (2003); People v. Stivers, 338 Ill. App. 3d 262, 264 (2003). However, this court has not specifically addressed whether a trial court may summarily dismiss a petition on the ground that the claim is barred by res judicata. See People v. Smith, 345 Ill. App. 3d 742, 746 (2004). Appellate panels that have considered the issue have reached divergent conclusions.
 Defendant relies principally on People v. Blair, 338 Ill. App. 3d 429 (2003), appeal allowed, 205 Ill. 2d 594 (2003). There, the First District held that a trial court may not dismiss a petition at the first stage on the basis of waiver or res judicata. The court held that, like timeliness, these are procedural issues that do not address the substantive merit of the petition. Blair, 338 Ill. App. 3d at 431-32. The court further observed that People v. McCain, 312 Ill. App. 3d 529 (2000), one of the three cases consolidated for decision in Boclair, held that a petition could not be summarily dismissed on the ground of res judicata. Although the supreme court did not specifically mention res judicata in its opinion, it nevertheless affirmed McCain. Blair, 338 Ill. App. 3d at 431, citing Boclair, 202 Ill. 2d at 101. In People v. McGhee, 337 Ill. App. 3d 992, 994 (2003), a different panel of the First District reached the same conclusion.
 Later, another First District panel expressed its disagreement with McGhee and Blair. The court believed that waiver and res judicata are more closely related to a petition's substantive merit than the statute of limitations defense at issue in Boclair. People v. Smith, 341 Ill. App. 3d 530, 536-37 (2003). The court did not decide the issue, however, because the pleading in question was the defendant's second post-conviction petition, and the supreme court held in People v. Britt-El, 206 Ill. 2d 331, 341 (2002), that Boclair does not apply to successive petitions. Smith, 341 Ill. App. 3d at 537-38.
 In People v. Etherly, 344 Ill. App. 3d 599 (2003), the First District attempted to harmonize the pronouncements in Blair and Smith. The court concluded that res judicata could be the basis of a first-stage dismissal if the trial court did not engage in fact finding or consider evidence outside the record. Etherly, 344 Ill. App. 3d at 614. People v. Sutherland, 345 Ill. App. 3d 937 (2004), followed this approach.
 After considering these various approaches, we agree with McGhee and Blair that res judicata may not be the basis for summarily dismissing a petition. We note that res judicata is not an absolute bar to raising an issue. Various exceptions exist, and the doctrine will not be applied where it would be fundamentally unfair to do so. Cload v. West, 328 Ill. App. 3d 946, 953 (2002). For example, in Blair, the appellate court first considered the allegedly barred issue in the context of granting appellate counsel's motion to withdraw pursuant to Anders v. California, 386 U.S. 738, 18 L.Ed. 2d 493, 87 S.Ct. 1396 (1967). The defendant raised the issue in his pro se response to the motion and the appellate court rejected the issue on the merits. Blair, 338 Ill. App. 3d at 430. Thus, while the issue was ostensibly raised in the prior appeal, the defendant could plausibly argue that he did not have as full an opportunity to raise the issue as if it had been briefed by counsel. However, if the trial court were to dismiss his petition sua sponte, the defendant would not have a chance to argue that an exception to res judicata applies.
 In People v. Wright, the supreme court held that the State could not raise a statute-of-limitations defense for the first time on appeal. People v. Wright, 189 Ill. 2d 1, 10-11 (1999), overruled in part on other grounds, Boclair, 202 Ill. 2d at 99. The court expressed concern that allowing the State to raise the issue for the first time on appeal would deprive a defendant of the chance to amend his petition to overcome the defense, for example, by showing that the delay was not the result of his culpable negligence (see 725 ILCS 5/122--1(c) (West 2002)). Wright, 189 Ill. 2d at 11. A similar concern applies here. Allowing the trial court to summarily dismiss a petition on the basis of res judicata would deprive a defendant of the chance to amend his petition to respond to the defense.
 Here, the trial court dismissed the petition solely on the basis of res judicata. Accordingly, we reverse the order dismissing the petition and remand the cause for proceedings under sections 122--4 through 122--6 ...