Timing is everything. Consider, if you will, the story of Mary Barra, the first female chief executive of General Motors, who in less than a month went from pioneer to punching bag. For something that’s clearly GM’s fault, and some of her predecessors’ fault — but clearly not her fault.

Barra, who spent 33 years clawing her way to the top of GM, became its chief executive on Jan. 15, making her an icon of sorts. But less than a month later, GM began recalling vehicles because of a deadly, now-infamous faulty ignition switch. Instead of being praised for perseverance and cracking the glass ceiling, Barra is now a target, getting beaten up on a regular basis in televised congressional hearings, media scrums and other forums too numerous to name.

I don’t normally sympathize very much with chief executives, who get paid amazing amounts of money to assume a lot of responsibility, including taking the heat when the company screws up. If you’re getting eight-digit paychecks and thus benefiting from the work of everyone below you in the corporate hierarchy, it’s only fair that you get whacked for the sins of your subordinates, even if you knew nothing about them. The buck is supposed to stop somewhere, and the chief executive’s office is the right place.

But beating up on Barra, which satisfies the blood lust of Washington pols and makes for good theater and massive buzz, is absurd. Had the ignition-switch recall happened last year instead of less than 30 days after Barra took office this year, Dan Akerson, who became GM’s chief executive in 2010, would have been the one called in front of Congress to be tortured in the U.S. version of a show trial. Had GM or the National Highway Traffic Safety Administration or both of them been quick and competent, it might have been Akerson’s predecessor, Ed Whitacre, who was tortured.

I totally get the point of focusing blame on an individual, who’s identifiable, rather than diffusing it over a big, impersonal corporation. After all, that’s the kind of thing I have been doing for a living ever since I learned the art of personalizing companies during my days at Forbes magazine (not to be confused with my current employer, Fortune) more than 30 years ago.

A history of GM’s ignition problems

But if you’re going to beat up on an individual for the failure of a company, you ought to beat up the right individual — not the person who happens to be chief executive when the problem surfaces.

Maybe Congress should be calling Rick Wagoner, the company’s chief executive from June 2000 until the government forced him out in 2009 as the price of rescuing the company’s operations from collapse. The ignition problem seems to have started and been ignored sometime during his regime, even though I would be willing to bet that Wagoner (whom I know slightly, and kind of like) knew little or nothing about it. But he was in charge then.

Or you could call either of the two chief executives the federal government installed: Whitacre (Dec. 1, 2009, to Sept. 1, 2010) or Akerson (Sept. 1, 2010, to Jan. 15, 2014). There are two other short-timers, but they weren’t around long enough to be held responsible.

To be sure, the unfair beating that Barra is getting doesn’t approach the unfairness of the treatment that Ed Liddy got as chairman of AIG. Barra, after all, is a GM lifer with a serious comp package, while Liddy was serving at $1 a year to preside over a mess he had nothing to do with.

I’m all in favor of accountability. And if you want to hold Barra responsible for the mess of first admitting responsibility, then trying to use GM’s 2009 bankruptcy to shield the company from most of the death claims, be my guest.

But if we’re going to beat up chief executives for disasters like AIG’s reckless financial bets or GM’s deadly ignition switches, let’s beat up the people who were in charge when the mistakes were made. Not the people who happen to be in charge when the problems surface.

Sloan is Fortune magazine’s senior editor at large.