The failed vote is a major blow to Speaker Kevin McCarthy and hawks who had hoped to advance the spending bill.