Shares of Blue Apron plunged Thursday after the meal-kit delivery company said during its earnings call that it was encountering unexpected costs tied to starting up a new facility.

These costs, as well as further cuts in marketing spending, will likely result in more losses in the second half of the year.

Blue Apron now estimates that its net loss will be between $121 million and $128 million in the second half while net revenue will fall between $380 million and $400 million.

The stock opened trading Thursday down 17 percent.

Earlier Thursday, Blue Apron reported a steep second-quarter loss as the company spends heavily to recruit new customers.

Although the number of customers rose 23 percent year over year, the company said its client base shrank by 9 percent from the first quarter due to a planned $26.1 million reduction in marketing expenses.

Here's a quick look at the earnings report, Blue Apron's first since going public in late June.

EPS: loss of 47 cents per share, versus an expected loss of 30 cents per share;

Revenue: $238.1 million, versus a forecast of $235.8 million.

Since Blue Apron's IPO, analysts have questioned whether the company can cut its marketing spending and work to better retain customers. In 2016, Blue Apron had spent about 18 percent of its $795.4 million revenue on marketing. In the latest quarter, Blue Apron cut it to 14.5 percent.

Meanwhile, the company said its average revenue per customer increased to $251 for the second quarter, up from $236 in the previous quarter, but below $264 in the previous year. This helped boost the company's revenue 18 percent to $238.1 million for the quarter, beating analyst exceptions.

Investors will be watching how this plays out, especially as the company starts to pull back on marketing spending to offset higher-than-expected costs in starting up its new plant in Linden, New Jersey.

Blue Apron said during a conference call Thursday that it was seeing higher wage and labor costs and had problems transferring volume from its facility in Jersey City, which is set to close in October.

Blue Apron said it will spend 15 percent to 16 percent of its second-half net revenue on marketing. Spending will be higher in the third quarter and ratchet down in the fourth.

During the second quarter, the company posted a loss of $31.6 million, or 47 cents per share. Analysts had expected a loss of 30 cents per share on $235.8 million in revenue, according to Thomson Reuters estimates.