ORDER AND JUDGMENT*
Cynthia Quintero, a successful social-security litigant, appeals the district court’s order denying her motion for attorney fees under the Equal Access to Justice Act (EAJA), 28 U.S.C. § 2412. Exercising ju*794risdiction under 28 U.S.C. § 1291, we reverse.
Background
Quintero applied for disability-insurance benefits and supplemental security income payments due to a variety of impairments, including depression. An administrative law judge (ALJ) concluded she wasn’t disabled, as jobs existed in the national economy that she could perform given her age, education, work experience, and residual functional capacity (RFC). In reaching that conclusion,. the ALJ gave “little, if any, weight” to the mental RFC assessments of examining psychologist Jose G. Vega1 because they “were prepared at the behest of [Quintero’s] counsel in anticipation of th[e] [disability] hearing.” R., Vol. I at 15. Additionally, the ALJ downplayed the weight of Dr, Vega’s opinion because he was an examining rather than a treating physician.
Quintero sought review in the district court, complaining the ALJ had improperly discounted Dr. Vega’s opinion. She specifically challenged the ALJ’s decision discounting Dr. Vega’s opinion because he examined Quintero at the request of her counsel and because of his status as an examining physician. In doing so, she relied on McGoffin v. Barnhart, 288 F.3d 1248, 1253 (10th Cir.2002) (reiterating this court's longstanding view that a physician’s advocacy for “his patient’s cause is not a good reason to reject his opinion”), and Chapo v. Astrue, 682 F.3d 1285, 1291 (10th Cir.2012) (noting “the facially dubious proposition that the opinion of an examining medical source is, as such, dismissible”). In its response brief, the government didn’t address Quintero’s interpretation or application of either McGoffin or Chapo. Instead, the government specifically argued the ALJ had “reasonably weighed the opinion of Dr. Vega and reasonably crafted a[n] [RFC] assessment based upon that opinion.” Aplt.App. at 55. The government did not seek to excuse any error as to Dr. Vega’s opinion on the basis of harmlessness.
The district court agreed with Quintero insofar as' the ALJ had discounted Dr. Vega’s opinion because it was prepared at the request of her counsel. See id. at 152 (“[T]he regulations do not contemplate discounting opinions solely because they were prepared for advocacy purposes; rather, the decision to discount an opinion must result from weighing the factors described in the' regulations.”). But the district court found the error was harmless. To the extent the ALJ discounted Dr. Vega’s opinion because he “was not a treating psychologist,” R., Vol. I at 15, the district court stated simply that the ALJ had properly declined to give his opinion “controlling [weight], as he was not a treating source,” ApltApp. at 151.2
On appeal to this court, Quintero again raised McGoffin and Chapo. This time, the government specifically addressed McGoffin in its response brief, suggesting that this court’s renunciation in McGoffin of the practice of discounting physician opinions prepared at the request of counsel applied only to treating physicians and not to examining physicians like Dr. Vega. See id. at 193. The government argued:
*795Unlike the physician in McGoffm, Dr. Vega was not Quintero’s family doctor— in fact, Dr. Vega did not provide treatment and Quintero was not receiving any mental health treatment at the time she saw Dr. Vega. Rather, as the ALJ correctly observed, Quintero saw Dr. Vega only in connection with her disability claim AND application. Thus, the rationale in McGoffm that it is not unusual for a treatment team to advocate for a patient does not apply here.
Id. at 193-94.
The government further suggested: “In any event, even if McGoffm did control in this case, the fact that the ALJ noted that Dr. Vega’s opinion was prepared at the behest of [Ms.] Quintero’s attorney in preparation for the hearing ... would not change the outcome of this case.” Id. at 194. As for Chapo, the government didn’t specifically address its proscription against the outright dismissal of an examining medical source’s opinion. But the government impliedly rejected that holding by arguing the ALJ “properly noted that [Ms.] Quintero saw Dr. Vega on only a few occasions and did not see him for treatment.” Id. at 193 (emphasis added).
This court found error under both McGoffm and Chapo. Regarding McGof-fm, the panel observed that this court had “long ago rejected” the implication that “a consulting examiner’s opinion is necessarily less trustworthy when it is sought or obtained by the claimant.” Quintero v. Colvin, 567 Fed.Appx. 616, 620 (10th Cir.2014). Notably, the panel specifically observed that “rejecting Dr. Vega’s opinion on the ground the opinion was obtained by Quintero’s counsel fail[ed] to follow the established legal rules for weighing medical opinions.” Id. (citing 20 C.F.R. §§ 404.1527(c) and 416.927(c)). As for Chapo, the court stated that Dr. Vega’s status as “an examining rather than a treating physician was not a valid reason for rejecting the opinion.” Id. The court found that these errors, and others involving the weighing of Dr. Vega’s opinion, were not harmless.3 Thus, this court reversed the district court’s judgment and remanded the case for further proceedings.
On remand, the district court denied Quintero’s motion for attorney fees under EAJA, prompting this appeal.
DISCUSSION
Quintero argues she is entitled to EAJA fees because the ALJ committed “very basic errors in the application of very simple and clear rules for assessing medical opinions.” Aplt. Opening Br. at 24 (emphasis omitted). These errors, she continues, were significant because they provided “no basis for judicial review of her treatment of the medical opinions.” Id. at 24-25 (emphasis omitted). Quintero further contends “[i]t was not reasonable for the Commissioner to argue in Federal Court that the ALJ properly discounted Dr. Vega’s opinion by considering the fact that Dr. Vega was only an examining physician and that he was hired by Ms. Quintero’s attorney in anticipation of the hearing.” Id. at 32.
*796The government responds that its position regarding Dr. Vega’s opinion “was reasonable in light of the relevant legal authorities and the facts of this case.” Aplee. Br. at 19. It asserts that “during the litigation on the merits, the Commissioner never took the position that the ALJ [had] discounted” Dr. Vega’s opinion because of his “status as an examining source.” Id. at 21. Rather, the government claims, “Quintero introduced this reading of the ALJ’s" decision.” Id. Regarding the advocacy nature of Dr. Vega’s opinion, the government contends “the Commissioner reasonably argued that the ALJ gave other valid reasons for discounting Dr. Vega’s opinions.” Id. at 28.
Under EAJA, a fee award is required if (1) the plaintiff is a “prevailing party”; (2) the position of the United States was not “substantially justified”; and (8) there are no special circumstances that make an award of fees unjust. 28 U.S.C. § 2412(d)(1)(A). The term “position” “may encompass both the agency’s preliti-gation conduct and the [government’s] subsequent litigation positions.” Comm’r, INS v. Jean, 496 U.S. 154, 159, 110 S.Ct. 2816, 110 L.Ed.2d 134 (1990). The only dispute in this appeal is whether the government’s position was substantially justified.
A position is substantially justified for EAJA purposes if it is “justified in substance or in the main — that is, justified to a degree that could satisfy a reasonable person.” Pierce v. Underwood, 487 U.S. 552, 565, 108 S.Ct. 2541, 101 L.Ed.2d 490 (1988) (internal quotation marks omitted). Thus, a position may be substantially justified even though it is incorrect, so long as there is “a reasonable basis in law and fact” for it. Id. at 566 n. 2, 108 S.Ct. 2541. A position taken by the ALJ or government that “contravene[s] longstanding agency regulations, as well as judicial precedent,” is not substantially justified. Stewart v. Astrue, 561 F.3d 679, 684 (7th Cir.2009); accord Washington v. Heckler, 756 F.2d 959, 962 (3d Cir.1985) (“When the government’s legal position clearly offends established precedent ... its position cannot be said to be ‘substantially justified.’ ”). We review the district court’s denial of Quintero’s EAJA motion for an abuse of discretion. See Pierce, 487 U.S. at 559, 108 S.Ct. 2541.
We first address the ALJ’s error in discounting Dr. Vega’s opinion because he was an examining, rather than a treating, psychologist. Chapo clearly prohibits an ALJ from per se rejecting an examining medical source’s opinion. Chapo, 682 F.3d at 1291 (providing that an ALJ may not end the assessment of an examining physician’s opinion by merely recognizing a “limited professional relationship with [the claimant]”). We reject the government’s assertion that Quintero somehow “introduced this reading of the ALJ’s decision,” Aplee. Br. at 21, thereby injecting Chapo error where none existed. To the contrary, in the district court, Quintero properly framed the issue by (1) pointing out that one of the ALJ’s reasons for assigning little, if any, weight to Dr. Vega’s opinion was his status as an examining psychologist; and (2) conceding that Dr. Vega’s opinion was not entitled to controlling weight. And when Quintero brought the issue to this court’s attention on appeal, the panel observed that the ALJ had indeed discounted the value of Dr. Vega’s opinion simply because he was an examining psychologist, and found Chapo error. Quintero v. Colvin, 567 Fed.Appx. 616, 620 (10th Cir.2014).
We are also unpersuaded by the government’s claim that it never argued the ALJ could properly discount an examining source’s opinion. True, in the district court the government didn’t contend that the *797ALJ was free to discount Dr. Vega’s opinion merely because he was an examining source. But the government nevertheless maintained — despite Quintero’s assertion of Chapo error — that the ALJ had “reasonably weighed Dr. Vega’s opinion and reasonably determined Plaintiffs [RFC].” Aplt.App. at 50. That the district court didn’t find error is unpersuasive, as the district court didn’t address Quintero’s Chapo argument. Further, on appeal to this court, the government more directly attempted to support the ALJ’s Chapo error by arguing — again in the face of Quintero’s Chapo argument — that the “nature of the treatment relationship,” i.e.,'by an examining rather than a treating source, was sufficient in itself to discredit Dr. Vega’s opinion. Id. at 193; see also id. (stressing that “Quintero saw Dr. Vega on only a few occasions and did not see him for treatment”).
We next turn to the ALJ’s error in discounting Dr. Vega’s opinion because it was obtained by Quintero’s counsel. More than 13 years ago, this court held in McGoffin that a physician’s advocacy posture is an insufficient reason to reject a medical opinion. And McGoffin based its holding, in turn, on a case decided 15 years earlier, Frey v. Bowen, 816 F.2d 508, 515 (10th Cir.1987) (stating that a physician’s “natural[ ] advocacy [for] his patient’s cause” is an insufficient reason to reject the physician’s opinion because it is no more than a conclusory observation).
Without addressing McGoffin specifically, the government impliedly suggests that it never maintained that the ALJ properly relied on Dr. Vega’s advocacy posture as a basis to uphold the decision. Instead, the government suggests it has maintained a reasonable position throughout the litigation by “argu[ing] that the ALJ gave other valid reasons for discounting Dr. Vega’s opinions.” Aplee. Br. at 28 (emphasis added). And, as the government points out, this court has held that “[e]ven when the ALJ’s reasons were unreasonable, EAJA fees may still be denied when the Commissioner reasonably (even if unsuccessfully) argues in litigation that the ALJ’s errors were harmless.” Groberg v. Astrue, 505 Fed.Appx. 763, 765-66 (10th Cir.2012). Quintero counters that the government’s harmless-error defense “would not cure all of the ALJ’s errors” and “necessarily falls back on other invalidated reasons, or other post hoc reasons.” Aplt. Opening Br. at 35.
We reject the government’s “harmless error” defense for simpler reasons — i.e., the government raised this argument late in the litigation and only as an alternative position. Specifically, the government didn’t argue harmlessness until Quintero’s first appeal to this court. And notably, the government asserted its harmless error argument alternatively to its initial argument in which it urged this court to distinguish McGoffin as only prohibiting the discounting of treating physicians’ opinions. See Aplt.App. at 193-94 (arguing that McGoffin didn’t apply to Dr, Vega because he “was not Quintero’s family doctor” and it would be “unusual for [him] to .advocate for a patient”). But nothing in McGoffin indicates its holding reaches only to opinions offered by treating physicians. Instead, in both McGoffin and Frey, this court reasoned that the rejection of a physician’s opinion based on the fact that a physician is an advocate for his or her patients is no more than a concluso-ry statement, contrary to the established process for weighing medical opinions. See McGoffin, 288 F.3d at 1253; Frey, 816 F.2d at 515.
Thus, even if the government had advanced a reasonable harmless-error argument, its refusal to concede McGoffin error in both the district court and this court *798was unreasonable. See Comm’r, INS v. Jean, 496 U.S. 154, 161-62, 110 S.Ct. 2316, 110 L.Ed.2d 134 (1990) (stating that “the EAJA ... favors treating a case as an inclusive whole, rather than as atomized line-items”); Hackett v. Barnhart, 475 F.3d 1166, 1173 n. 1 (10th Cir.2007) (rejecting the argument that EAJA fees can be denied solely because the government prevailed on a majority of issues).
In light of McGoffin and Chapo, we conclude it was unreasonable for the ALJ to give “little, if any, weight” to Dr. Vega’s RFC opinion and for the government to defend that position. And because the government’s position in this case regarding Dr. Vega was not substantially justified, the district court abused its discretion in denying Quintero’s motion for attorney fees. See 28 U.S.C. § 2412(d)(1)(A) (providing that an attorney fee award is mandatory unless the government shows either that its position was substantially justified or that special circumstances make an award unjust). Accordingly, we reverse the judgment, of the district court and remand this case to the district court to award Quintero reasonable attorney fees.