After days of uncertainty and intraparty tensions coming to a head, Republicans in the House of Representatives passed a bill on Thursday night that will keep the U.S. government up and running for another month.

But it has mere hours to pass the Senate, where its fate is grim, or else the government will begin to shut down when the clock strikes midnight on Friday.

If this happens, the effects will be wide-reaching: the stock market will likely take a hit, since a government that can’t stay open doesn’t give investors much confidence in its economic resources; Americans who need passports — no matter how urgent the reason — will have to wait for the government to reopen for their applications to be processed. Tourists visiting Washington, D.C., won’t be allowed to stroll on the National Mall, one of the national parks that will have to close.

How did we get here? The short answer: an unprecedented fever of partisanship in Congress, both between the two parties and within them, exacerbated by a volatile president whose inconsistencies and broken promises have only made things worse. It is worth noting, as many lawmakers did bitterly on Thursday night, that all of this was preventable. But no one can decide who’s to blame.

“This whole process is careening,” Democratic Rep. Joe Courtney of Connecticut said outside the meeting room in the Capitol where members of his party were eating Chinese takeout ahead of the House vote. “It’s just absurd. Since this administration has been in office, we’ve operated for eight out of twelve months on [continuing resolutions]. They own that.”

He was referring to the repeated temporary funding measures that have kept the government’s lights on in recent months — an easier, and widely condemned, alternative to passing a complete fiscal year budget. The bill that passed the House on Thursday night was the fourth in as many months. On previous occasions — once in late September and twice in December — the bills made it through, with lawmakers operating under a tacit understanding that punting the spending issue ahead would give them time to iron out the kinks of more sensitive political matters: reauthorizing the federal Children’s Health Insurance Program (CHIP) and securing a legislative replacement to Deferred Action for Childhood Arrivals (DACA), which President Donald Trump repealed in September. (The deadline for such a replacement is March 5).

There were initially hopes that this time, things would be different, especially on immigration. Last week, in a bipartisan meeting with lawmakers at the White House, Trump appeared ready to commit to a DACA fix, saying that “he’d take the heat.” Democrats were optimistic that such a deal could come with the funding bill, but within days, Trump backpedaled, tweeting that the DACA plan was “probably dead.”

Democrats quickly moved to play hardball. On Tuesday, Senate Minority Leader Chuck Schumer stressed to reporters the urgency of addressing DACA, saying that “we continue to believe, insist, that it be in this bill.” But the bill that was introduced neglected the immigration issue altogether, only extending government funding through February 16 and renewing the funding for CHIP for six years.

“This is like giving you a bowl of doggie doo, putting a cherry on top, and calling it a chocolate sundae,” House Minority Leader Nancy Pelosi said of the bill on Thursday. “This is nothing.”

“It’s not gonna pass over here,” one senior Democratic aide said frankly on Thursday afternoon. “This is not a bill that we’re going along with. We want them to come to the table and negotiate with us.”

Republicans accused the Democrats of abject recklessness. “I think the American people clearly would not expect us to act this way,” Senate Majority Leader Mitch McConnell said on the Senate floor on Thursday. “The bill before us is an opportunity to correct course.”

But even when it was clear that Democrats would withhold their votes in the Senate, the Republican leadership had a more urgent matter at hand: ensuring that members of their own party in the House would support the bill. The chief gadfly was Rep. Mark Meadows of North Carolina, who chairs the Freedom Caucus, the bloc of conservative House Republicans that has subtly thumbed its nose at the leadership of Speaker Paul Ryan. (Late last year, rumors surfaced that Meadows was plotting a coup against Ryan’s speakership, which were taken with more than a grain of salt: it was Meadows who orchestrated the ouster of Ryan’s predecessor, John Boehner.)

Meadows’ ostensible chief lament was the fact that the temporary funding measure raised concerns about military funding. Up until the end of Thursday afternoon, he suggested to reporters that he and the members of the Freedom Caucus would not vote for the bill, potentially derailing it. (It was a meeting with Ryan about an hour before the vote that apparently changed his mind, with Ryan reportedly promising him a vote in the near future that would increase defense spending.)

The ephemeral drama spoke to a more concrete truth: that the unruly right flank of the Republican conference is a force to be reckoned with. “It remains to be seen what Congressman Meadows actually wants,” one Republican aide fumed on Wednesday. When asked about the rumors of mutiny several hours before the vote, Meadows demurred. “If they were true, I wouldn’t tell you,” he said.

The bill now faces the Senate, where it appears certain to fail in its current form. Republicans have prematurely pinned the blame on Democrats — the #SchumerShutdown, they’re calling it — but its detractors include a critical mass of Republicans that will keep the bill from reaching the 60 votes needed to pass. On Thursday night, Sen. Jeff Flake of Arizona, who has come to blows with Trump in part because of the president’s hardline views on immigration, told reporters that he would not vote for the continuing resolution. Instead, he backed a suggestion floated by Schumer and Sen. Jerry Moran of Kansas: an even shorter stopgap measure that would provide lawmakers with enough time to finalize a bipartisan DACA fix.

But the primary hurdle now is time. The Senate returns to the Capitol just before noon on Friday morning, at which point they will have twelve hours to keep the government open — at least for the time being.

Get our Politics Newsletter. The headlines out of Washington never seem to slow. Subscribe to The D.C. Brief to make sense of what matters most. Please enter a valid email address. Sign Up Now Check the box if you do not wish to receive promotional offers via email from TIME. You can unsubscribe at any time. By signing up you are agreeing to our Terms of Use and Privacy Policy . This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply. Thank you! For your security, we've sent a confirmation email to the address you entered. Click the link to confirm your subscription and begin receiving our newsletters. If you don't get the confirmation within 10 minutes, please check your spam folder.

Contact us at letters@time.com.