The last few years have been lucrative for the stock market, with the S&P 500 (^GSPC -0.02%), Nasdaq Composite (^IXIC +0.01%), and Dow Jones Industrial Average (^DJI -0.31%) all notching multiple record highs in 2026.
AI stocks have fueled much of this growth. Within the S&P 500, the tech sector alone has soared by nearly 155% over the last three years. Meanwhile, all other sectors combined have earned total returns of just over 60% in that time.
Concerns about an AI bubble have been looming for years, and, for the most part, Wall Street has shrugged them off. However, the market recently signaled a new warning sign that has only been seen ahead of the dot-com bubble in the early 2000s -- and Warren Buffett has a warning for investors.
Image source: Getty Images.
Valuations are entering bubble territory
While no stock market indicator can predict the market's short-term movements, they can provide a snapshot of how current market conditions compare to previous downturns.
The S&P 500 Shiller CAPE Ratio is a metric that measures the S&P 500's 10-year inflation-adjusted earnings. A higher ratio suggests the S&P 500 is more likely to be overvalued, and historically, stock prices tend to fall in the years after this metric peaks.
Dating back to 1871, this ratio has averaged out to around 17. It experienced its first major spike in 1929 ahead of the Great Depression, and it surged again in the late 1990s as tech stocks ballooned in value.
S&P 500 Shiller CAPE Ratio data by YCharts
In January 1999, this metric surpassed 40 for the first time in history. It stayed above that level for another year before the dot-com bubble officially burst in March 2000 -- leading to a bear market that would last over two years.
Today, it's repeating a similar pattern. The CAPE Ratio surpassed 40 again in May of this year and has remained above 40 ever since. This is only the second time in history that this ratio has stayed above 40 for months at a time.
Warren Buffett is issuing a warning for investors
Earlier this year, in an interview with CNBC at Berkshire Hathaway's annual meeting, Warren Buffett offered his advice on investing in this historically expensive market.
Buffett reminded investors that he often compares the market to a church with a casino attached. One represents slow-and-steady long-term investing, while the other symbolizes short-term risk-taking.
"[W]e've never had people in a more gambling mood than now," Buffett warned, adding that this type of short-term buying is "not investing, it's not speculating, it's gambling. Just totally."
He added, however, that "that doesn't mean that investing is terrible. It does mean that prices for an awful lot of things will look very silly."
History says Buffett is right
Right now is not a bad time to invest in the stock market -- as long as you're investing in the right places. As valuations climb, it's more likely that some stocks are overvalued.
Overvalued stocks are particularly risky right now, even if they don't seem like it. Weak stocks can earn lucrative returns in the near term if they're fueled by hype, but the market tends to correct itself eventually. Over time, these stocks tend to experience severe downturns and underperform the market.
The dot-com bubble is a shining example of the risk of buying overvalued stocks. Despite record-breaking initial public offerings (IPOs) and monumental valuations, hundreds of tech stocks crashed and never recovered when the bubble popped.
The good news, though, is that strong stocks have historically survived even the worst bear markets and recessions. For example, while the S&P 500 lost nearly half of its value throughout the dot-com bear market, the index has earned total returns of nearly 1,500% since it bottomed out in October 2002.
While no one can predict exactly when a bear market will arrive, it's wise to prepare early. The stocks most likely to survive a recession are those of strong companies with healthy underlying business fundamentals.
Even the best stocks can experience short-term volatility, but by holding them for the long haul, you can set yourself up for lucrative returns over time.








