At one point this month renewable energy sources briefly supplied close to 90 percent of the power on Germany’s electric grid. But that doesn’t mean the world’s fourth-largest economy is close to being run on zero-carbon electricity. In fact, Germany is giving the rest of the world a lesson in just how much can go wrong when you try to reduce carbon emissions solely by installing lots of wind and solar.

After years of declines, Germany’s carbon emissions rose slightly in 2015, largely because the country produces much more electricity than it needs. That’s happening because even if there are times when renewables can supply nearly all of the electricity on the grid, the variability of those sources forces Germany to keep other power plants running. And in Germany, which is phasing out its nuclear plants, those other plants primarily burn dirty coal.

Now the government is about to reboot its energy strategy, known as the Energiewende. It was launched in 2010 in hopes of dramatically increasing the share of the country’s electricity that comes from renewable energy and slashing the country’s overall carbon emissions to 40 percent below 1990 levels by 2020 (see “The Great German Energy Experiment”). What happens next will be critical not only for Germany, but also for other countries trying to learn how to best bring more wind and solar online—especially if they want to do it without relying on nuclear power.

Germany has struggled to manage its surge in solar and wind capacity.

Some aspects of the Energiewende have been successful: renewable sources accounted for nearly one-third of the electricity consumed in Germany in 2015. The country is now the world’s largest solar market. Germany’s carbon emissions in 2014 were 27 percent lower than 1990 levels.

However, an expert commission appointed by the country’s minister of economy and energy has said the 40 percent target probably won’t be reached by 2020. And the energy revolution has caused problems of its own. Because fossil-fuel power plants cannot easily ramp down generation in response to excess supply on the grid, on sunny, windy days there is sometimes so much power in the system that the price goes negative—in other words, operators of large plants, most of which run on coal or natural gas, must pay commercial customers to consume electricity. That situation has also arisen recently in Texas and California (see “Texas and California Have Too Much Renewable Energy”) when the generation of solar power has maxed out.

In hopes of addressing such issues, Germany’s Parliament is expected to soon eliminate the government-set subsidy for renewable energy, known as a feed-in tariff, that has largely fueled the growth in wind and solar. Instead of subsidizing any electricity produced by solar or wind power, the government will set up an auction system. Power producers will bid to build renewable energy projects up to a capacity level set by the government, and the resulting prices paid for power from those plants will be set by the market, rather than government fiat.

The auction system is designed to reduce the rate of new renewable-energy additions and keep Germany from producing too much power. It might seem like an easy way to solve the oversupply issue would be to shut down excess power plants, especially ones that burn coal. But not only are the coal plants used to even out periods when wind and solar aren’t available, they’re also lucrative and thus politically hard to shut down. Because German law requires renewable energy to be used first on the German grid, when Germany exports excess electricity to its European neighbors it primarily comes from coal plants. Last fall, the German subsidiary of the Swedish energy giant Vattenfall started up a 1,600-megwatt coal-fired plant that had been under construction for eight years, defying opposition from politicians, environmental organizations, and citizens who want to see coal plants eliminated.

Putting a steep price on carbon emissions would hasten the shutdown of German coal plants. But Europe’s Emissions Trading Scheme, designed to establish a continentwide market for trading permits for carbon emissions, has been a bust. Prices for the permits are so low that there is little incentive for power producers to shut down dirty plants.

Also helpful would be a Europewide “supergrid” that would enable renewable power to be easily transported across borders, reducing the need for reliable, always-on fossil fuel plants to supplement intermittent electricity from solar and wind. “If you want to use fluctuating renewable power, you have to upgrade the grids across Europe,” says Daniel Genz, a policy adviser with Vattenfall. Efforts to build that grid are under way, but they’ll be expensive: between €100 billion and €400 billion ($112 billion to $448 billion), according to a November 2015 report from e-Highway2050, which was formed by the European Union to plan for a pan-European power grid.