Next month world leaders will gather at the COP26 summit, saying they mean to set a course for net global carbon emissions to reach zero by 2050. As they prepare to pledge their part in this 30-year endeavor, the first big energy scare of the green era is unfolding before their eyes.

Since May the price of a basket of oil, coal and gas has soared by 95%. Britain, the host of the summit, has turned its coal-fired power stations back on, American petrol prices have hit $3 a gallon. Blackouts have engulfed China and India. And Vladimir Putin has just reminded Europe that its supply of fuel relies on Russian goodwill.

The panic is a reminder that modern life needs abundant energy. Without it, bills become unaffordable, homes freeze and businesses stall. The panic has also exposed deeper problems as the world shifts to a cleaner energy system, including inadequate investment in renewables and some transition fossil fuels, rising geopolitical risks and flimsy safety buffers in power markets.

Without rapid reforms there will be more energy crises and, perhaps, a popular revolt against climate policies.

The idea of such a shortage seemed ridiculous in 2020 when global demand dropped by 5%, the most since the Second World War, triggering cost-cutting in the energy industry. But as the world economy has cranked back up, demand has surged even as stockpiles have run dangerously low.

Oil inventories are only 94% of their usual level, European gas storage 86%, and Indian and Chinese coal below 50%.

Tight markets are vulnerable to shocks — and to the intermittent nature of some renewable power. The list of disruptions includes routine maintenance, accidents, too little wind in Europe, droughts that have cut Latin American hydropower output, and Asian floods that have impeded coal deliveries.

The world may yet escape a severe energy recession: The glitches may be resolved and Russia and OPEC may grudgingly boost oil and gas production. At a minimum, however, the cost will be higher inflation and slower growth. And more such squeezes may be on the way.

That is because three problems loom large.

First, energy investment is running at half the level needed to meet the ambition to reach net zero by 2050. Spending on renewables needs to rise. And the supply and demand of dirty fossil fuels needs to be wound down in tandem, without creating dangerous mismatches.

Fossil fuels satisfy 83% of primary-energy demand and this needs to fall toward zero. At the same time the mix must shift from coal and oil to gas, which has less than half the emissions of coal. But legal threats, investor pressure and fear of regulations have led investment in fossil fuels to slump by 40% since 2015.

Gas is the pressure point. Many countries, particularly in Asia, need it to be a bridge fuel in the 2020s and 2030s, shifting to it temporarily as they ditch coal but before renewables have ramped up. As well as using pipelines, most import liquefied natural gas (LNG). But too few projects are coming on stream. According to Bernstein, a research firm, the global shortfall in LNG capacity could rise from 2% of demand now to 14% by 2030.

The second problem is geopolitics, as rich democracies quit fossil-fuel production and supply shifts to autocracies with fewer scruples and lower costs, including the one run by Putin. The share of oil output from OPEC plus Russia may rise from 46% today to 50% or more by 2030.

Russia is the source of 41% of Europe's gas imports and its leverage will grow as it opens the Nord Stream 2 pipeline and develops markets in Asia. The ever-present risk is that it curtails supplies.

The last problem is the flawed design of energy markets. Deregulation since the 1990s has seen many countries shift from decrepit state-run energy industries to open systems in which electricity and gas prices are set by markets, supplied by competing vendors who add supply if prices spike. But these are struggling to cope with the new reality of fossil-fuel output declines, autocratic suppliers and a rising share of intermittent solar and wind power.

Just as Lehman Brothers relied on overnight borrowing before its collapse triggered the financial crisis of 2008, so some energy firms guarantee household and business supplies that they buy in an unreliable spot market.

The danger is that the shock slows the pace of change. This week Li Keqiang, China's premier, said the energy transition must be "sound and well-paced," code for using coal for longer. Public opinion in the West, including America, supports clean energy, but could shift as high prices bite.

Governments need to respond by redesigning energy markets. Bigger safety buffers ought to absorb shortages and deal with the intermittency of renewable power. Energy suppliers should hold more reserves, just as banks carry capital. Governments can invite firms to bid for backup-energy-supply contracts. Most reserves will be in gas but eventually battery and hydrogen technologies could take over. More nuclear plants, the capture and storage of carbon dioxide, or both, are vital to supply a baseload of clean, reliable power.

A more diverse supply can weaken the grip of autocratic petrostates such as Russia. Today that means building up the LNG business. In time it will require more global trade in electricity so that distant windy or sunny countries with renewable power to spare can export it. Today only 4% of electricity in rich countries is traded across borders, compared with 24% of global gas and 46% of oil. Building subsea grids is part of the answer and converting clean energy into hydrogen and transporting it on ships could help, too.

All this will require capital spending on energy to more than double to $4 trillion-$5 trillion a year. Yet from investors' perspective, policy is baffling. Many countries have net-zero pledges but no plan of how to get there and have yet to square with the public that bills and taxes need to rise. A movable feast of subsidies for renewables, and regulatory and legal hurdles make investing in fossil-fuel projects too risky.

The ideal answer is a global carbon price that relentlessly lowers emissions, helps firms judge which projects would make money, and raises tax revenue to support the energy transition's losers.

Yet pricing schemes cover only a fifth of all emissions. The message from the shock is that leaders at COP26 must move beyond pledges and tackle the fine print of how the transition will work. All the more so if they meet under light bulbs powered by coal.