Investors that favor the semiconductor industry likely got pretty excited when Warren Buffett's company Berkshire Hathaway revealed last year that it had opened a new position in the world's largest chipmaker, Taiwan Semiconductor (TSM -3.50%).

Not only did Berkshire buy the stock, but it purchased a pretty sizable position valued at more than $4 billion at the time.

However, this excitement didn't last long, because Berkshire just revealed that it sold roughly 86% of that position during the fourth quarter of the year. Berkshire's sudden reversal breaks one of Buffett's cardinal rules of investing.

Buffett is a long-term investor

Buffett has always been known as a long-term investor, and as such so has Berkshire Hathaway, which Buffett has been running very successfully for decades.

Being a long-term investor does not mean holding stocks for a few months, or even for a few years. Typically, long-term investors are holding stocks for at least five years -- and in Buffett's case, being a long-term investor has often meant holding stocks for decades.

Warren Buffett.

Image source: Motley Fool.

Buffett has famously said in the past "that our favorite holding period is forever," referring to how long Berkshire likes to hold stocks. Buffett has also said that if you don't see yourself holding a stock for 10 years then you shouldn't bother buying it for 10 minutes.

The reason Buffett likes to hold stocks for long periods of time is to prevent human emotion from taking over, which can cause investors to buy at the top or sell at the bottom. The only reason to sell suddenly, says Buffett, is due to some kind of huge change that hurts the business model, such as labor issues or if a product or service becomes outdated.

What changed?

After reading everything above, the next thought one might have is what could have possibly changed in such a short period of time. Well, Buffett and the investors at Berkshire Hathaway are some of the best investors in the world, so it's difficult to know exactly what spooked them.

We do know that Taiwan Semiconductor had a pretty healthy fourth quarter, with earnings growing 5.4% from the third quarter. The company had a net profit margin of 47.3% and a return on equity of 41.7%. But management did say that they expect the 2023 capital expenditure budget to be lower than expected, between $32 billion and $36 billion, citing lower expected demand in the chip industry.

Perhaps Berkshire sensed this coming in the fourth quarter and got worried about what the industry would be like if there is some kind of big global recession. The semiconductor industry can certainly be cyclical. The other concern could be on the geopolitical front regarding China and its often tense relationship with Taiwan.

It's not always clear

From where we are today, I think many investors expect the chip industry to be a long-term winner. Given its strong position, Taiwan Semiconductor would seem like an obvious beneficiary.

But Buffett and the savvy investors at Berkshire might have seen something that made them pause and reassess. They also invest with quite a different mindset than the common retail investor, because their portfolio is over $350 billion. Sometimes a company is doing well and Berkshire will sell it anyway because of broader macro fears, or they feel they need to position the portfolio a certain way.

Additionally, while Buffett and Berkshire often invest long-term, they've made sudden changes to stocks before. For instance, at the end of 2020, Berkshire purchased 48.5 million shares of Chevron. Then the next quarter the large conglomerate chopped the stake in half, only to significantly increase its position in Chevron over the last few years.

While they are some of the best investors in the world, Buffett and his team are still only human, so they'll miss things and change their minds from time to time like anyone else. Things can change very quickly, and being a good investor also means being able to adapt.