The question is very broad covering everything from failure to launch to a stuck part requiring a gentle nudge. Someone can address all the engineering solutions to particular problems, but I'm going to address the hard reality that...
Failure is always an option.
Any exciting space rescue has to be cheaper, simpler, and less risky than just building a new one. "At any cost" includes building another JWST and fixing whatever went wrong before the second launch.
When the Cluster mission blew up on takeoff in 1996, after returning what was left to the science team, they built and flew a second one, Cluster II, in 2000. The explosion was considered a four-year delay.
Much of the \$10 billion cost came from development and a 14-year delay. The original cost was \$500 million. Building a second JWST would cost somewhere in between.
Even if it costs another \$10 billion, that may be cheaper and less risky than mounting a repair mission. Robotic repair missions are brand new, and JWST is on hardcore mode.
We have to diagnose the problem(s) from 1.5 million km away on a spacecraft designed to shield itself from the Earth. We have to devise fixes for a spacecraft not designed to be fixed. We have to design and outfit a robotic spacecraft with everything it needs to perform the repair semi-autonomously in zero-G without further damage to JWST and send it 1.5 million km away. While we're developing all that, JWST could be incurring further damage.
JWST is risky and expensive, but it isn't doing anything we haven't done before; it's just doing them all at once.
First, JWST can try to repair itself.
If it turns out to be a snag during deployment, JWST has options.
It can heat and cool the part causing it to expand and contract and wiggle itself loose. It can do this by turning heaters and equipment on and off, and exposing the part to sunlight and shadow.
It can run various motors and gyroscopes to attempt to flex the part and wiggle it loose.
It can use its own thrusters to apply force to the part. It can rotate creating a centrifugal force on the part. It can oscillate to try and shake the part lose. And it can accelerate putting a linear force on the part.
These have all been done on spacecraft before with various levels of success.
If that doesn't work, the likelyhood of a successful repair drops rapidly.
Then, send an observation probe.
Before mounting an expensive and risky rescue mission, send a smaller, cheaper probe to observe JWST and perform diagnostics.
We can't just take a peek at JWST through a telescope. JWST is 1.5 million km away and, if oriented correctly, always pointed away from the Earth. It is not designed to look at itself. A small craft with cameras would help diagnose the problem for a limited cost.
Only then would you assess whether a robotic servicing mission is worth the cost, or if it would be cheaper and simpler to make a new one.
This alone would take months to design, build, test, launch, and travel to L2. During this time JWST may be taking additional damage because...
JWST is very fragile.
Hubble was more like a traditional telescope, a long tube with a mirror inside. It had lens caps which could be closed to protect the mirror.
JWST lets it all hang out. All its parts are exposed to space. It has an enormous mirror, and a very, very, very thin Sun shield.
Any time spent out of orientation or without its sun shield deployed can potentially damage JWST from the Sun. Any time spent in LEO can potentially damage it with debris. Any spacecraft maneuvering near it risks damaging its mirror and sun shield with propellant.
This complicates any repair. The longer JWST has to wait for repair, the more likely it will take additional damage. Any spacecraft which approaches to repair risks further damaging JWST.
Maneuvering near JWST risks spraying the mirror with propellant. In order to apply any direct force, it would have to securely grapple JWST on some make-shift grapple points risking damage to itself and JWST, and that grapple would have to be strong and secure enough to resist the applied force.
Any use of thrusters near the JWST would be done off-angle to avoid sending the exhaust straight at JWST. For example, if it needs to move away from JWST it would simultaneously fire thrusters 45 degrees above and below the direction of JWST creating a net force away.
If the problem requires contact with JWST, it might be cheaper and simpler to make a new one.
This is a job for a robot.
We can't send an astronaut to fix JWST.
The last time a human went beyond LEO (about 300km up) was almost 50 years ago, Apollo 17 in 1972. They went to the Moon 300,000 km away. The whole trip was a little over 12 days. We don't plan on returning to the Moon until 2025 the earliest, and that's costing \$35 billion.
JWST is 1.5 million km away. It took 30 days to get there, one way.
We'd have to send astronauts, and all their stuff to survive in deep space for at least 60 days, and all the fuel to get there and back. This is closer to a Mars mission than a trip to the Moon.
It has to be a robot, and a semi-autonomous one. We've never done that.
The robot has to be semi-autonomous
While robotic servicing missions have been considered for Hubble, that is in LEO where the robot can be controlled from the ground. JWST is at L2 5 light-seconds away. Ground control will be working with a 10 second lag. The robot will have to be semi-autonomous.
This is not unheard of, Mars rovers have a lag of minutes, but it sure complicates things.
Robotic servicing is in its infancy
To repair JWST we need to develop and mature many new technologies.
Robotic servicing and refueling missions are only in the technology demonstration phase.
Right now NASA is working on OSAM-1: On-orbit Servicing, Assembly, and Manufacturing. It will "rendezvous with, grasp, refuel and relocate a government-owned satellite to extend its life". OSAM includes Space Infrastructure Dexterous Robot (SPIDER) with a 5 meter robotic arm. "SPIDER will assemble seven elements to form a functional 3-meter communications antenna".
Those are known problems, specially designed to be performed by robots, in LEO. In contrast, JWST is at L2, it is not designed to be repaired, the fault may not be fully understood, and it is very fragile.
That's a tall ask for a technology only in the demonstrator phase.
Doing repairs in zero-G is very hard
Let's say the robot has a wrench it wants to undo a bolt on JWST. On Earth, when it applies force to the wrench gravity and friction hold the robot and JWST in place; the bolt turns.
In space, noting is holding the robot nor JWST in place. There's only inertia. JWST weighs 6000 kg. When the robot applies force to the wrench, unless its firmly attached to JWST, the robot turns.
JWST has no grappling points nor docking ring designed to secure another spacecraft to. The articles claiming they added one all refer back to one 2007 mention of a plan to add a docking ring for Orion which does not appear to have happened. So the robot has to figure out how to attach itself firmly to JWST in a position where it can affect repairs without damaging itself or JWST.
Fix it without touching it?
Very, very minimal force may be required to release the snag. If that's the case, a robotic mission could apply force without contacting JWST.
It could use a laser to rapidly heat and cool the snagged part causing it to expand and contract and eventually wiggle itself loose.
It could use gyroscopes to spin while spooling out a tiny weight on a filament. Done very precisely, the weight can be made to gently knock lose the stuck part.
Or instead of a weight, a hook to snag the stuck part (doing this near the sun shield is terrifying); once snagged the spacecraft can reel in the line fast and slow (relatively) using its own inertia to jerk the part free. Or it can carefully use thrusters, again angled above and below to avoid sending exhaust directly at JWST.
Which is all to say, if it comes down to sending a repair robot it might be easier and cheaper to just build another JWST. FWIW Scott Manley agrees.
Here's some details about failure at various stages.
Any failure before upper stage jettison
De-orbit it and build a new one.
Why? Let's assume after the failure in the first stage, upper stage, or fairing separation (see below) you can somehow get JWST into a stable orbit and keep it there during the months and years to prepare a serving mission.
The Ariane 5 upper stage is designed for a 30 minute flight. While its waiting in orbit, its fuel and fluids are freezing, leaking, and evaporating. In addition to repairing whatever went wrong, that servicing mission now has to fix and refuel or replace the upper stage. That has never been done.
After fairing separation its mirror and sun shield are exposed. Its flight pattern is specifically designed to protect it from the Sun. While in low Earth orbit waiting for rescue, JWST will inevitably be damaged by the Sun and debris adding to the repair hassle. Like buying a used car that's been sitting unprotected outside, you can fix what you know is wrong, but meanwhile everything is degrading.
If it misses L2.
Learn from your mistakes, declare it lost, and build a new one.
While waiting for the rescue mission to be mounted, JWST will be drifting further and further adding to the delta-V necessary to bring it back to L2. It risks damage from the Sun due to being out of position, orientation, or having its sun shield not deployed.
The repair mission has to chase JWST. Once its caught it, it has to dock firmly with a spacecraft that was not designed for docking, though a gravity tractor is possible. It has to avoid further damaging JWST. And it has to have sufficient remaining delta-V to bring JWST and itself to L2.
This is all before it conducts repairs. Though perhaps the repair should be done by a second spacecraft.
The 6000 kg JWST coasted to L2 with no fuel and minimal propulsion. This pushed the limits of our heavy launch capability. This rescue craft would have to carry fuel for itself and JWST. Due to the tyranny of the rocket equation this is A LOT more fuel.
+1– uhoh Dec 25 '21 at 01:12