If budget writers don’t come up with money to address a state employee pension shortfall and mounting needs for public schools, health care and transportation, credit agencies are likely to downgrade Texas’ AAA rating in the near future.

That was the warning Comptroller Glenn Hegar gave lawmakers at a Tuesday hearing of the Senate Finance Committee in Austin. Though the Texas economy is growing at a healthy pace, Hegar said, the state’s budget is riddled with enough unfunded liabilities to worry credit rating agencies such as Moody’s and Standard and Poor’s.

“We’re not at a crisis,” Hegar said, but “we’re going in the wrong direction.”

A downgrading of Texas’ credit rating would make it more expensive for the state to borrow money — and perhaps damage state leaders’ credibility when advertising Texas as “open for business.”

“I want to avoid that, because I think that’s a black eye on the state of Texas,” Hegar said.

Rebounding oil prices, natural growth and migration to Texas have led to an increase in tax collections, according to the comptroller’s office. But much of that new revenue is already dedicated to historically underfunded programs such as the state highway fund, meaning that Texas lawmakers likely won’t have more money at their disposal in 2019 when crafting the next two-year budget.

At the same time, lawmakers will need to plug holes in the pension system for state employees, and they’ll face pressure to make solvent a health insurance program for retired teachers. On top of that, big bills coming due for Medicaid, the federal-state health insurance program for the poor and disabled that is perennially underfunded by the Legislature, could put the state budget $2.5 billion in the red before lawmakers even convene in 2019. (The state’s current two-year budget is about $217 billion.)

In addition, state leaders will have to tackle the bills from Hurricane Harvey recovery.

Hurricane-related costs are “adding up and are going to have a major impact on our budget,” state Sen. Jane Nelson, a Republican of Flower Mound and the budget committee chairwoman, said.

All that has credit rating agencies on notice, and they’ve told Hegar that a downgrade is likely. Texas’ current triple-A rating is the highest available, meaning credit agencies believe that the state can easily meet its financial commitments.

In January, the comptroller cautiously predicted that state coffers will only have a $94 million “beginning balance” when lawmakers convene in 2019. By comparison, lawmakers had an $880 million beginning balance in 2017, which was a tight year for the state budget. Two years before that, lawmakers enjoyed a $7.3 billion beginning balance.

Other rainclouds loom on the horizon for the state budget. The Texas Tomorrow Fund, a public university tuition payment program that stopped accepting enrollment in 2003, is projected to face a $240 million budget shortfall. The state treasury will also soon feel the effects of an amendment to the Internet Tax Freedom Act passed by Congress, which is expected to cause a $440 million loss in sales tax revenue.

Hegar believes budget writers need to find additional money to meet all of the state’s obligations, but the traditional ways that government raises money — levying new taxes or raising existing ones — are political non-starters in deep red Texas.

Instead, Hegar pitched to lawmakers the idea of investing a larger portion of the state’s Economic Stabilization Fund, an emergency pot of money also known as the Rainy Day Fund that’s available to budget writers during times of economic stress.

Like a person who stores his or her life savings in cash under a mattress, lawmakers are allowing much of the $10 billion emergency fund to depreciate over time because of inflation, Hegar said. Current law requires that a “sufficient balance” — about $7.5 billion today — be maintained as a cash fund, but Hegar believes that money should be invested.

If lawmakers in 2017 had allowed a state-run trust company to invest the entire fund to keep pace with inflation, the comptroller estimates budget writers would have an additional $128 million at their disposal for 2018 and 2019. Over 10 years, the higher-risk, higher-yield investment plan would likely return $825 million, Hegar said.

A similar proposal pushed by Hegar in 2017 failed in the waning days of the legislative session. At the time, Gov. Greg Abbott said Hegar’s idea “looks like a smart strategy.”

“We are very grateful for your caution, warning to us, and you’ve been warning us for quite a while,” Nelson said, adding that the Legislature “may need to take a big draw” from the Rainy Day Fund next session.

State Sen. Kel Seliger, R-Amarillo, appeared skeptical of Hegar’s idea, saying the additional returns from investing the Rainy Day Fund “would seem to be trivial” in terms of affecting the state’s credit rating. “For the life of me I can’t find out how they impact a bond rating," he said.

Seliger pressed for specifics about an item in Hegar’s presentation that noted the Legislature’s “weak funding practices.”

“Other than pensions, what do you find weak funding practices? Are they revenues or are they expenditures?” Seliger asked.

Hegar said the Legislature’s history of underfunding pensions was of greatest concern, followed by the Texas Tomorrow Fund and deferred maintenance for state buildings.

State Sen. Charles Schwertner, R-Georgetown, said the proposal was “very interesting” but not without risk. “You could have a five-year return that’s actually negative,” he said, raising the specter of what would have happened to the Rainy Day Fund investment in 2008, at the start of the Great Recession.