Residential solar stocks have been on a massive run higher in 2017 as the market became more bullish on solar stocks in general. Vivint Solar (VSLR) has more than doubled, Sunrun (RUN 4.99%) is up 36%, and SolarCity-owner Tesla (TSLA -1.06%) is up 54%. 

The question is: Why? There may be some huge headwinds ahead for residential solar companies, and when they start showing up in second-quarter earnings reports, it may set us up for a weaker-than-expected earnings season. 

VSLR Chart

VSLR data by YCharts.

Costs could be moving higher

One of the biggest factors driving the long-term success, or failure, of residential solar companies, is costs. You can see below that costs have fluctuated over the past two years at Vivint Solar, but costs have been volatile over the past two years at Vivint Solar and don’t show signs of rapid declines like they did early this decade. 

Chart of Vivint Solar's cost per watt wince Q1 2014.

Image source: Vivint Solar Q1 2017 earnings release.

But second- and third-quarter 2017 trends could be working against solar companies. There are reports that solar panel prices have jumped from lows around $0.35 per watt to as much as $0.60 per watt. If that's true, a $0.25 per watt increase in costs could wipe out most of the margin Vivint and Sunrun expect long term. 

As they move to selling solar systems, it would put pressure on either margins or their own selling prices. Higher costs for solar panels may lead them to raise prices, which would reduce the size of their potential market overall. Everything about rising solar panel costs is bad for installers, it's just a matter of how bad and how quickly the rising cost will hit their income statements. 

Large rooftop solar installation.

Image source: Getty Images.

Not what residential solar installers need

This comes at a time when national solar installers are fighting against smaller, local and regional installers who have lower costs. And they've been losing market share to these smaller companies since early 2016. Higher costs would hit everyone, but it could push customers to the low-cost suppliers, which isn't likely to be the national installers. 

What to watch in earnings

Rising solar panel prices will definitely be something to watch, and both cost per watt and margins could be affected in the second quarter. Those will be the two metrics I'm watching most closely, particularly at Vivint Solar and SunPower, because Tesla doesn't break out solar data in the same way SolarCity did. 

It'll also be important to see how installations are trending. Tesla has been shrinking their solar businesses, but Vivint and Sunrun have spent most of 2017 expanding. Watch to see if that raises operating costs, and how many extra installations those expansions bring.