For long-term investors not concerned with the daily fluctuations of the stock market, risk comes from two sources. The first are from the businesses themselves. If a company doesn't perform as well as you expected it to over the long run, your return on investment could fail to meet your expectations, and you could lose money. Rising competition, changing consumer habits and preferences, and countless other factors have the potential to derail even the soundest investment thesis.

The second source of risk is the valuation. The best company in the world can make for a terrible investment if you pay too high a price for its stock. The higher the price relative to the fundamentals, the riskier the investment, all other things being equal. Finding great companies is easy; having the patience to only buy when the price is right is hard.

Image source: Costco.

Costco (COST -0.67%) is in an enviable position. While many retailers are struggling to adapt to a world where e-commerce continues to grow in importance, Costco's warehouse club model has largely insulated it from the online sales threat. That won't remain true forever, though, which is why e-commerce is still the biggest threat to Costco over the long term.

A slow embrace of the Internet

Just 4% of Costco's revenue came from its online businesses in fiscal 2016, less than $5 billion. That includes both e-commerce sales as well as business delivery and travel; Costco doesn't break out product sales through its website separately.

It's clear that Costco doesn't view internet-based sales as a major growth driver, at least not yet. The word "e-commerce" shows up just three times in the company's latest 10-K. Costco's business model is built around getting its members to drive out to its cavernous warehouse stores and buy items in bulk. The standard model of online retail doesn't mesh well with this strategy.

While Costco's growth strategy continues to be centered around its stores, management is aware of the threat posed by e-commerce. CFO Richard Galanti, answering an analyst's question during Costco's third-quarter earnings conference call, discussed how the company viewed online retail:

"The internet in general is going to take its percentage of different categories. It's going to impact different categories and different retailers of such categories at different levels. I've read the reports that some of you have written about that we and maybe one or two other retailers out there that are unique are Amazon-proof, or internet-proof. We don't buy that for a minute. We do believe that we do rely and we do expect we're going to be impacted less. We also don't believe we have to go crazy on the other side. We want both. But our value proposition is best served for us when it's in-store, getting members to come in and buying when they can see everything there that we have."

Costco isn't being nearly as aggressive when it comes to e-commerce as other brick-and-mortar retailers because it doesn't have to be. Its membership is growing, comparable sales are increasing, and earnings are on the rise. But just as the grocery business is on the verge of being upended, with Amazon building concept grocery stores, and Wal-Mart aggressively pushing its online grocery service, the warehouse club business model could eventually be upended as well. Costco isn't immune to disruption. If the company fails to anticipate what its customers want, it could be in big trouble down the road.

A lofty valuation

Because Costco is rightfully viewed as a high-quality business, the stock trades at an optimistic valuation. The company produced net income of $5.33 per share in fiscal 2016, putting the P/E ratio at 30. Wal-Mart and Target trade at just 15.5 and 14 times trailing-twelve-month earnings, respectively.

There's no question that Costco stock is expensive, especially considering that the company isn't growing all that fast. Revenue rose by just 2.2% in fiscal 2016, while EPS, adjusted for a one-time tax benefit, grew by 3.2%. This lofty valuation makes the stock risky for investors, no matter what effect e-commerce ultimately has on Costco's business.

Because investors have pushed up shares of Costco so high over the past few years, I think its stock is far riskier than that of other retail giants that aren't performing as well. At a lower price, Costco stock would be an investment you'd be thrilled to buy and hold for years. But at its current valuation, Costco stock looks like a risk not worth taking.