If investing were as simple as buying stocks with the best growth potential, everyone could be Warren Buffett. But alas, that's just not the case -- the price you pay for an investment matters. Shares of the best company bought at the wrong price can make for a terrible investment, even if that company does well in the long run.

Graphics chip company Nvidia (NVDA 3.37%) is on the ground floor of the AI revolution. The company's powerful data center graphics chips churn through AI training workloads, and they're in high demand as a result. Nvidia blew away expectations last time it reported quarterly results by providing an outlook driven by incredible demand for its AI chips.

Price matters

You could argue that Nvidia's AI growth story isn't quite as ironclad as it seems by talking about the competition. AMD is set to launch its own powerful AI chip, along with a new open software platform for GPU compute meant to provide an alternative to Nvidia's ecosystem. Intel already sells capable AI chips, the result of its acquisition of Habana Labs. And big tech companies like Alphabet are multiple generations into their own custom AI chip development efforts.

It's unlikely that Nvidia will remain as dominant as it currently is in the AI chip market, but that's not the reason to be wary of the stock. Instead, the company's stratospheric valuation should give investors pause.

Nvidia is currently valued at about $1.05 trillion. Based on the average analyst estimate for revenue and adjusted earnings for the current fiscal year, the stock trades for 25 times sales and 55 times earnings. These are estimates, remember, which are based on a fair amount of optimism on the part of analysts.

The question that investors need to ask: What could go wrong for Nvidia?

Increased competition is one thing that could derail Nvidia's growth. But consider this: The companies buying reams of Nvidia's GPUs, and those renting them from cloud providers, for the purpose of training AI models are working under the assumption that these investments in AI will generate a positive return. What if they don't? Like in any frenzy, a huge amount of money is going to be thrown at things that ultimately won't pan out.

This isn't to say that AI won't drive demand for AI chips for years to come. But will the severe undersupply of AI chips continue indefinitely? Nothing ever does. AI is the hot thing right now, and venture capital is being thrown at AI companies.

But hot things come and go. AI is a gold rush, and Nvidia sells picks and shovels. While AI technology is here to stay, the gold rush phase will eventually end.

Is it reasonable, then, to pay 25 times forward sales for Nvidia stock? It might be, but there's little room for anything to go wrong. Nvidia's revenue and profit could soar in the coming years thanks to AI chip demand, and the stock could still be a losing investment. All it will take is for that growth to come up short of the expectations embedded in the sky-high stock price.

Maybe Nvidia will turn out to be a great investment from here. But given the valuation, that's far from a guarantee.