Of course, our failure to predict the afghani military's collapse is a huge error but that just proves that even world's best and most well-funded intelligence agency is not foolproof.
It was obvious to people who had any inkling of Afghanistan.
First, the US created an Afghani army that was dependent on US weapons and logistics, but stopped helping to maintain it even before the withdrawal was done. What does one expect to happen to an airforce when one stops maintance?
Second, every intelligence estimate predicted the Taliban would eventually win post-withdrawal (since they still got a state to support them), and the Afghanis knew about those estimates. Why should a sane Afghani keep fighting, when they could switch sides and live? To make Biden look better?
Ultimately, there was a political decision to leave Afghanistan, and the intel was adjusted to the decision rather than the other way around.
Which state would that be?