Testimony by Gen Mark Milley and Gen Frank McKenzie to Congress seemed to contradict President Joe Biden, who said he did not recall any such advice.
The Taliban took power in August, after rapidly advancing through the country.
Gen Milley said the US had been taken by surprise by the speed of the Afghan government's collapse.
The two US generals were questioned by the Senate armed services committee along with Defence Secretary Lloyd Austin on Tuesday.
The hearing comes weeks after a chaotic withdrawal at Kabul airport as foreign powers sought to get their citizens home and thousands of desperate Afghans begged for rescue.
A suicide attack killed 182 people during the withdrawal operation. Thirteen US service personnel and at least 169 Afghans were killed by the airport gate on 26 August.