The House of Representatives voted 216-212 against starting debate on the $886 billion defense appropriations bill amid opposition from a small group of ultra-conservative Republicans.
It marks a setback for McCarthy after his divided Republican majority met for two and a half hours in search of consensus on legislation to avoid a fourth government shutdown in a decade starting Oct. 1.
With the vote failing, McCarthy told reporters he would follow "the same strategy that I have followed since January: just keep working, never give up."
Federal agencies will begin shutting down on Oct. 1 unless Congress passes either a short-term continuation resolution or a year-long funding bill.
House Republicans have so far failed to unite on either eventuality, and the ideas they have discussed have only Republican support, making it unlikely that they will win support in the Democratic-majority Senate or be signed into law by President Joe Biden.
Fitch Ratings has cited repeated last-minute negotiations that threaten the government's ability to pay its bills as one of the reasons it downgraded U.S. debt to AA+ from AAA this year.
A small group of ultra-conservative Republicans oppose the Republican spending program, wanting guarantees that the 2024 appropriations will not exceed the 2022 cap of $1.47 trillion, $120 billion less than McCarthy and Biden agreed in May.