White House Counsel Don McGahn was reportedly blindsided by a tweet from President Trump Wednesday morning that he was out the door this fall.

McGahn was not aware that Trump planned to send the tweet before it posted, The Washington Post reported, citing a source.

“He was surprised,” the source said.

It was an open secret inside the White House that McGahn planned to leave after the confirmation of Brett Kavanaugh to the Supreme Court was wrapped up.

But McGahn had not discussed his plans with Trump, the paper reported.

“White House Counsel Don McGahn will be leaving his position in the fall, shortly after the confirmation (hopefully) of Judge Brett Kavanaugh to the United States Supreme Court. I have worked with Don for a long time and truly appreciate his service!” Trump tweeted Wednesday morning.

McGahn — who has fully cooperated with special counsel Robert Mueller’s Russia investigation — threatened to quit earlier this year after Trump threatened to fire Mueller.

Some GOP lawmakers sounded stunned at McGahn’s departure.

Iowa GOP Sen. Charles Grassley, chairman of the Senate Judiciary Committee, tweeted after the president’s announcement: “I hope it’s not true McGahn is leaving White House Counsel. U can’t let that happen.”

His tweet prompted some snark from DC lawyer George Conway, the husband of White House counselor Kellyanne Conway and a frequent Trump critic.

“Remember the eighth amendment senator,” he tweeted at Grassley and Trump, a reference to the Constitution’s ban on cruel and unusual punishment.