President Donald Trump has been fretting about Boeing for some time. “It’s a very disappointing company,” he said while at the Davos World Economic Forum last month. “This is one of the greatest companies of the world, let’s say as of a year ago, and all of a sudden things happened.”

And they just keep happening.

We just learned that Boeing’s new Starliner space capsule designed to take U.S. astronauts to the International Space Station had flawed software that could have led to a catastrophic failure. This only emerged as NASA was investigating another flaw that in December sent an unmanned test flight off course and caused it to be curtailed without reaching deep space.

BOOTS ON THE MOON

As first reported by Space News, the newly uncovered flaw was so serious that Paul Hill, a member of NASA’s Safety Advisory Panel, said, “The panel has a larger concern with the rigor of Boeing’s verification processes. Further, with confidence at risk for a spacecraft that is intended to carry humans in space, the panel recommends an even broader Boeing assessment of, and corrective actions in, the testing.”

This is a pretty stunning development, since it was problems with new software that were at the heart of the biggest crisis ever to hit Boeing, following two crashes of the Boeing 737MAX jet that killed 346 people—a crisis that has severely damaged the company’s reputation and led to a grounding of the airplane that has so far cost it at least $16 billion.

“ Trump wants Americans back on the moon before the end of what he confidently expects to be his second term, by 2024. ”

What is particularly alarming about the new revelations is that the failures occurred in another and entirely separate Boeing division, the aerospace division contracted by NASA to provide a new generation of launch vehicles that ultimately are intended to return U.S. astronauts to the moon.

This suggests that the failure to detect flawed engineering that has a specific and direct bearing on safety, whether of airline passengers or astronauts, is endemic throughout Boeing, and not just the commercial airplane division.

And this is where Trump’s disenchantment with Boeing becomes hugely consequential. He wants Americans back on the moon before the end of what he confidently expects to be his second term, by 2024. That deadline has put NASA under intense pressure. Until Trump set his own deadline they were not planning to be able to put “boots on the Moon” until at least 2026—indeed, one anonymous NASA engineer said that all that they could deliver to the moon by 2024 was a pair of boots.

ENTER ELON

But as Boeing’s star falls in Trump’s reckoning another has risen with the panache and confidence of a true disruptor: Elon Musk. In fact, be prepared for an unlikely bromance between Trump and Musk.

This was foreshadowed when the president, in an interview with CNBC, also at Davos, delivered a remarkable, if somewhat incoherent, encomium of Musk: “He likes rockets. And he does good at rockets, too, by the way. I never saw where the engines come down with no wings, no anything, and they’re landing. I said ‘I’ve never seen that before.’ He’s one of the world’s great geniuses, we have to protect all of these people that came up with originally the light bulb and the wheel and all of these things. And he’s one of our very smart people, and we want to cherish those people.”

Musk has been getting the president’s attention because his SpaceX company is disrupting the conventional space launch business as much as his car company, Tesla, is disrupting the conventional auto industry. Boeing’s latest fiasco serves to show just how that contest is playing out.

Once NASA decided to outsource space launches to private industry, albeit under its own supervision, two groups were contracted to provide the booster rockets and the vehicles required for three things: to carry astronauts, to carry cargo, and to launch the next generation of government satellites. The two groups were the United Launch Alliance, ULA, combining Boeing and Lockheed Martin—and SpaceX .

Musk decided to offer something the ULA could not—booster rockets that were reusable, rather than ending their only flight as pieces of junk falling into the ocean. So far SpaceX has done this 44 times, using some of the boosters as many as three times. Nobody else in the world has that ability. SpaceX has designed, built and launched three generations of rockets into orbit and is building a fourth, as well as launching 60 small satellites into orbit.

And while the Boeing Starliner capsule is now grounded awaiting fixes to its software, Musk’s rival Dragon capsule has already made a successful six-day unmanned test flight to the International Space Station—and demonstrated that in the event of an aborted launch because of a failed booster the capsule can self-eject and return the astronauts safely to earth. It’s only a matter of months now before the SpaceX capsule will be ready to fly astronauts.

Patricia Sanders, head of the NASA Safety Review Panel, said last week that its assessment of the SpaceX program “is at a point where there is not a question of whether they will be flying crew in the near term, but when, and under what risk conditions.”

FATAL FLAWS

Boeing’s problems with NASA run deep. The flawed software governed the capsule’s critical re-entry into the earth’s atmosphere at the end of a mission. If undetected the flaws would have fired the wrong thrusters when the capsule separated from its service module (which remains in orbit while the capsule carrying the astronauts is put into a very precise trajectory for re-entry).

That would have caused a collision that, the NASA investigation showed, could have damaged the capsule’s heat shield and sent it tumbling into space, dooming the crew.

The discovery of this flaw was taken so seriously that NASA was forced to reassess its own oversight procedures. “Our oversight was insufficient” said Douglas Loverro, the associate administrator for human explorations. This problem echoes what happened with the 737MAX program, where the FAA had to admit that its oversight of Boeing had been far too lax. The message is clear: every new Boeing project has now to be closely watched by regulators.

“ Boeing’s problems with NASA run deep. ”

Boeing has already said it is taking a $419 million charge against earnings to cover the cost of having to make a second uncrewed flight with the capsule before it can advance to a manned flight. Boeing said it accepted the suggestions from the NASA panel as well as recommendations from a separate NASA review team.

Let’s be clear. SpaceX is not solely the work of “one of the world’s great geniuses.” Musk is clearly a visionary but he is also the kind of leader who builds a successful company culture by giving other talents the chance to prove themselves. From its beginning SpaceX has been significantly steered by Gwynne Shotwell, who is now the president and chief operating officer and responsible for the quality of its engineers.

She told an investor conference last October: “I think engineers think better when they’re pushed hardest to do great things in a very short period of time, with very few resources.” She pointedly made the contrast between SpaceX and the industry behemoths that she competes with: “Boeing and Lockheed like their cushy situation.”

Trump needs all the help he can get if he is to fulfill his aim of returning American astronauts to the moon by 2024. Who else is there for him to turn to—and to cherish—but a man he thinks might re-invent the wheel?