During the first few months of 2017, Tesla (TSLA 1.85%) seemed to be on a roll. In the first quarter, the company set a new quarterly record with 25,051 vehicle deliveries -- split across the Model S and Model X -- and posted solid gross margin of more than 27%. At the same time, it moved closer to launching its Model 3 sedan.

The Model 3 continued progressing through the development process last quarter. Enthusiasm for the Model 3 made Tesla one of the best-performing U.S. stocks during the first half of the year. Shares have surged as much as 80% in 2017, before pulling back sharply since late June.

TSLA Chart

Tesla year-to-date stock performance. Data by YCharts.

Tesla still plans to make its first Model 3 deliveries to customers before the end of this month. However, a bigger problem is cropping up. Demand for the more profitable Model S and Model X vehicles appears to be fading.

Tesla misses its delivery goal

On Monday evening, Tesla announced that it delivered just over 22,000 vehicles in the second quarter, a little more than 12,000 Model S sedans and a little over 10,000 Model X SUVs. In total, Tesla delivered about 47,100 vehicles during the first half of 2017. That was near the bottom of its guidance range, which called for 47,000-50,000 deliveries.

Tesla blamed the sequential decline in deliveries on severe shortages for its new 100 kWh battery packs. The company had resolved these issues by the end of the quarter, so they shouldn't affect production going forward. Additionally, Tesla added more vehicles to its service loaner fleet and to its Model X display and test-drive fleet during the quarter.

There's a bigger problem

While the sequential drop in Tesla's vehicle deliveries has received plenty of press attention, in theory it could be written off as the result of temporary production issues. Indeed, supply constraints have been a constant at Tesla for the past five years. CEO Elon Musk has often boasted that Tesla can sell every car it can build even with no discounting and no advertising.

The Tesla Model S

Tesla's Model S has had a wait list since before it entered production in 2012. Image source: Tesla.

The real concern is its forecast for the second half of 2017. "Provided global economic conditions do not worsen considerably, we are confident that combined deliveries of Model S and Model X in the second half of 2017 will likely exceed deliveries in the first half of 2017," Tesla stated.

That's hardly a ringing endorsement of demand. First, it implies that Tesla no longer has a big backlog of Model S and Model X orders to smooth out ups and downs in order activity. Second, it suggests that Tesla demand is more sensitive to economic conditions than investors may have previously believed. Third, it means that Tesla is unable or unwilling to implement actions that would stimulate demand.

This shouldn't be a huge shock

With the much-hyped Model 3 going into production now, it wouldn't be a huge surprise if demand for the Model S and Model X were declining. After all, the price of entry to the Tesla brand is about to drop by 50% or more.

Furthermore, Tesla may be starting to pay the price for its decision to make incremental hardware and software improvements over time -- some of which are delivered over the air to existing Tesla owners -- rather than having distinct model years for each vehicle. This is a very customer-friendly policy. However, it means that Tesla can't rely on loyal customers frequently trading in their cars to buy the latest models, as do other luxury carmakers.

The Model S is now five years old. According to the standard Detroit automaker playbook, it would be time for a comprehensive redesign soon. The Model X is still relatively new, but it hasn't been as popular as expected. One issue has been quality issues on early production models. More importantly, media hype has focused almost exclusively on the Model 3 for the past couple of years.

As Model 3 production ramps up in the next few quarters, Tesla's total sales will soar. But if Tesla can't sustain demand for the pricier (and presumably more profitable) Model S and Model X, the stock could continue to surrender its big gains from the first half of 2017.