If you go back and look at the beginning of 2017, it seemed like the year would be terrible for solar companies. It was so bad that SunPower Corporation (NASDAQ:SPWR) announced layoffs and the shutdown of a large manufacturing plant, and First Solar (NASDAQ:FSLR) decided to skip straight from Series 4 to Series 6 modules. 

What happened instead was a record year for solar energy globally. Even in the U.S., there's high demand for solar panels as installers stockpile solar modules ahead of potential import tariffs. The great year surprised nearly everyone. 

Utility scale solar installation in a field with trees in the background.

Image source: SunPower.

Predictions of a bad year never came true

Two main factors drove predictions of a bad 2017. The first was an expected decline in U.S. installations after the solar investment tax credit (ITC) was extended. Originally, the ITC was supposed to expire at the end of 2016, causing a rush of projects to be built last year. Instead, the subsidy was extended, leaving installers and utilities with little reason to rush to build projects in 2017. As a result, installations will fall from 14.6 GW in 2016 to about 12 GW this year. China had an even bigger impact on the global market. 

China's installations were 34.5 GW last year, the most any country has ever installed, and after a slowdown in the second half of 2016 it seemed likely 2017 would be a slow year. But the country left generous subsidies in place and installed 24.4 GW in the first half of 2017, and is on pace to install around 40 GW of solar in 2017. 

Both results are better than expected, and installations are expected to grow from about 75 GW in 2016 to 85 GW in 2017. Solar panel prices are even up because of the strong demand. It's not the down year everyone expected. 

Hindsight is 20/20

One of the impacts of higher-than-expected demand and stockpiling in the U.S. is higher-than-expected solar panel prices, which should help all manufacturers. First Solar is taking advantage of that by keeping Series 4 manufacturing open as long as possible, which is one reason it raised guidance after the end of the second quarter. But in hindsight, it might have delayed the Series 6 upgrade a year or two as planned, and moved to Series 5 into 2017. That would have left less disruption in its production in 2017 and 2018. 

SunPower might not have shut down its E-Series production last year, choosing to keep it open and take advantage of strong U.S. demand this year. Rising panel prices could have been a boon for the company short-term, although those tariffs may have forced the plant closure long-term anyway. 

Hindsight is 20/20, but it seems like both companies left some money on the table in 2017. 

Solar energy is tough to predict

As much as investors like to know what sales and earnings will look like years in advance, predicting the solar industry is nearly impossible. Experts and manufacturers didn't expect 2017 to be a good year at all, yet the industry is on its way to record installations, and high solar panel prices in the U.S. are leaving some manufacturers with windfall profits. 

More often than not, the solar industry grows faster than anyone expected. That can be a good thing for those betting on growth but can catch companies expecting a down year flatfooted. 

Travis Hoium owns shares of First Solar and SunPower. The Motley Fool recommends First Solar. The Motley Fool has a disclosure policy.