You can’t find a better metaphor for the current state of the MBTA than last month’s subway car derailments on the Green and Red lines. The agency’s struggles in keeping an aging system working, and on time, are well known. An unpopular fare hike that took effect at the beginning of the month isn’t nearly enough to cure the T’s ills. And that’s just at the surface. The MBTA has deeper problems in the form of retirement pensions it has promised to its former workers. It is running out of money to afford them.

As of 2017, the MBTA Retirement Fund, the kitty set aside to cover those benefits, only had enough assets to pay for 57% of what’s been promised, according to MassPensions.com, a Pioneer Institute website that monitors the health of 102 pension systems across the state. Data reported by the Boston Globe earlier this month shows the ratio has since slipped below 50% for the first time in anyone’s memory.

Mark Williams, a Boston University professor who follows the T’s pension, told the Globe it’s reached a “danger zone” where it will be  harder and harder to make good on obligations that must be covered today while nesting away enough cash to cover ones that will come due next month and next year. The MBTA pension today pays for the retirements of some 6,700 former workers; another 5,300 are paying into the fund with the expectation of collecting when their careers are finished.

This isn’t just an MBTA problem. This particular derailment is happening at all layers of state and local government, as the promises of the past outpace the money set aside to pay for them.

Take Marblehead, for example. The town’s retirement fund is in better shape than the MBTA’s in terms of how much it has socked away; it currently has enough assets to cover about two-thirds of its pension liability, according to MassPensions.com. Still, the overall size of that liability is growing quickly — at nearly 85 percent from 2012 to 2018, according to Pioneer. In Massachusetts, only Adams had a pension fund with liabilities increasing at a faster rate.

In Danvers, the town employee pension fund was large enough to cover just 58.6% of its liabilities at the beginning of 2018. That represents a slight improvement over the previous few years, to be sure, but a significant decrease from 71.3% in 2007. In Andover, the town pension at the beginning of 2018 was even less healthy than the MBTA’s, with assets that only amounted to 48.6% of liabilities.

The State Retirement Board, which serves more than 63,000 former employees of the commonwealth and various government agencies, had enough to cover about 65% of more than $40.4 billion in pension liabilities at the beginning of 2018. A dozen years earlier, by comparison, it was more than 89% funded.

It’s important to remember the myriad factors that bear on the health of a pension, including the performance of the stock market. But so does the number of retirees, which in most places is swelling with an aging population and a graying workforce.

A Pioneer report in February noted the state’s pension funds continue to strain even after correctives pursued under Gov. Deval Patrick’s administration, which include a more aggressive funding schedule: “Despite multiple efforts at reforming the state pension system, unfunded liabilities continue to rise and funding ratios continue to decline.”

The more these trends continue -- as other state and local pensions slip into the “danger zone” described by Williams -- the more that paying off retirement promises will create even bigger headaches for state and local budget writers. At the end of the day, it means less money for everything else government has to pay for.

The authors of Pioneer’s report in February urged another pass at pension reform at the state level, such as one creating a hybrid program for new hires with a traditional, defined benefit pension along with a defined contribution program. It’s an idea that merits study, along with other potential solutions, for both the state and local retirement boards.

Otherwise it won’t be long before our pension obligations, and the lack of funding for them, will derail our state and municipal budgets.