The Senate passed an $857 billion bipartisan spending bill on Thursday night, a move that Republicans and Democrats alike hope will avert the threat of a government shutdown next month.

The massive bill, which includes more money for the military, as well for as the departments of Health and Human Services and Education, has something for everyone — except for President Donald Trump. A last-ditch attempt to attach a provision defunding Planned Parenthood was ultimately defeated.

But one huge wild card stands in the way of this being just another spending bill Congress can check off its list: Trump has publicly and repeatedly threatened to shut down the government if he doesn’t get funding for a border wall — and has recently expanded his demands.

With just 11 working days left to go, the House and Senate must scramble to agree on a spending package in conference and get it to Trump’s desk to be signed. The clock is ticking; the threat of a government shutdown looms on September 30 — the day the government will run out of money.

The spending bill’s Trump problem, explained

Earlier this year, the president nearly vetoed a spending package because it didn’t have the funding he wanted. At the signing, he said he would “never sign another bill like this again.”

Since then, his hardline immigration demands have only increased, in direct odds with a Congress that would rather not take on a tough partisan fight so close to Election Day. Last month, Trump tweeted that he would again be willing to veto a spending bill if “Democrats do not give us the votes” on border security, so-called “catch and release,” and the diversity visa lottery.

I would be willing to “shut down” government if the Democrats do not give us the votes for Border Security, which includes the Wall! Must get rid of Lottery, Catch & Release etc. and finally go to system of Immigration based on MERIT! We need great people coming into our Country! — Donald J. Trump (@realDonaldTrump) July 29, 2018

The president has significant demands, covering issues that Congress has shown time and time again they can’t agree on. While Trump’s July tweet was vague on policy specifics, he was essentially calling for three sweeping immigration reforms.

1) Funding for the border wall. This is one Trump’s longest-standing asks on immigration. He’s demanded anywhere from $5 billion to the full $25 billion to build the wall. (Multiple reports have found that building the wall would actually cost much more than that.)

Democrats have been in lockstep against funding the wall from the start, but they’ve also been clear that they are willing to concede border wall and border security funding if Trump will agree to a legislative fix for the Deferred Action for Childhood Arrivals program. Trump, however, has rejected every Democratic-sponsored offer so far. Instead, he has espoused hardline views on immigration that Democrats won’t agree to and don’t even have consensus among Republicans.

2) An end to “catch and release.” “Catch and release” is what Republicans call the practice of releasing undocumented immigrants from detention and allowing them to live in the US while they wait for their asylum claims to be adjudicated. Trump’s administration has attacked this practice from the start, claiming it’s allowed for “widespread lawlessness,” as Vox’s Dara Lind explained. The Trump administration’s attempt to end catch and release is what ultimately led to the “zero tolerance” border policy and the separation of more than 2,500 immigrant children from their families.

The bipartisan backlash against family separations ultimately pushed the administration to reverse its policy — but the issue is not resolved. To fully address family separations, conservatives and Trump allies are calling for Congress to pass a law overturning a court order that prevents children from being detained indefinitely with their families at the border. This isn’t something lawmakers, past Trump’s most conservative allies on Capitol Hill, agree on.

3) Sweeping reforms to legal immigration. Every immigration proposal the White House has offered so far has demanded major changes to the legal immigration system — from getting rid of the diversity visa lottery program to ending family-based immigration. The idea is that people should only be allowed to enter the US if they demonstrate a valuable asset, instead of just being sponsored by their relatives. But Trump’s proposed reforms have all substantially cut the number of legal immigrants who would be allowed into the country — a reform that is a nonstarter for Democrats and that traditional Republicans are also uncomfortable with.

Senate Republicans are hoping the $20.4 billion boost in defense spending, including pay raises for members of the military, will be enough to sweeten the deal for the president and get him to swallow a bill without money for his beloved wall.

But it’s impossible to say if this will satisfy Trump, setting up the very real possibility for the second government shutdown under his presidency, just a few months before the November midterms.

This spending bill, explained

The Senate spending bill passed overwhelmingly on an 85-7 vote late Thursday night, without some of the major fireworks that have overshadowed past budgets.

Republicans and Democrats agreed to forgo any language on abortion funding in the bill, rejecting an amendment to defund Planned Parenthood introduced by Sens. Mike Lee (R-UT) and Rand Paul (R-KY), which was voted down 48-45.

This budget bill was a far cry from past Republican efforts to slash government spending. Under the Senate plan, the Pentagon would get a $20.4 billion increase, including a 2.6 percent pay raise for current members of the military and funding for more than 6,000 new troops.

The budget of the Department of Health and Human Services would also get a substantial funding increase of $2.3 billion. The National Institutes of Health — a program Trump’s administration threatened to make steep cuts to in its initial budget proposals — would get a 5.4 percent budget increase.

The Senate’s plan would see the Department of Education get a smaller increase of $541 million for national education programs, while the Labor Department’s budget would stay level, with no increases.

This isn’t the final version — the Senate still needs to meet with the House in conference and hammer out major sticking points. But with the midterms in a few months, everyone has incentive to try to make sure a spending bill sails through without drama. Republicans want to avoid a shutdown at all costs.

As much as everyone hopes this bill will be drama-free, odds are good that won’t happen

The bottom line is Trump is not backing down from demands for comprehensive immigration reform, something the Senate and House have tried and failed on both a bipartisan and partisan basis.

Trump is raising the stakes, tying his demands to a highly contentious spending fight mere months before an election.

If it were up to Republicans, Congress wouldn’t be dealing with immigration right now — and they certainly wouldn’t be advocating for a government shutdown in the months leading up to the midterms. Lawmakers typically avoid divisive issues in an election year.

For the past five months, the House and Senate have been sprinting to pass all 12 of their annual spending bills before the September deadline.

Republicans know government shutdowns are very unpopular. And Trump’s immigration agenda doesn’t fare well among voters overall. More than half of Americans — 58 percent — disapprove of how Trump has handled immigration matters, according to an early July Quinnipiac poll. A Reuters poll similarly found that 52 percent of Americans disapproved of Trump’s immigration agenda. Republicans are much more likely to approve of Trump’s immigration agenda, but a government shutdown over immigration policy could be disastrous for vulnerable Republican candidates.

But even in a year when Democrats are trying to harness their base’s enthusiasm to knock Republicans out of power in Congress, Trump hasn’t heeded his party’s political concerns. The coming weeks will be a test of whether he really has an appetite for a second shutdown — even if it has the potential to hurt his party’s electoral chances.