It is hard to keep track of which is expanding faster: the accelerating Universe that the James Webb Space Telescope (JWST) is designed to explore, or the telescope's cost, which last week inflated from US$5 billion to $6.5 billion. Even for NASA, which has a well-documented history of going over budget on major projects, the $1.5-billion jump is a shocker. Its consequences will surely be felt across the US astronomy community, as well as by the project's international partners. Even more distressing is the realization that the problems might have been avoided.

According to an independent review (see page 353), NASA administrators did the JWST a significant disservice by concealing its true costs after it was approved. Again and again, they passed overruns to the following year's budget in a hopeless effort to pay tomorrow for what was needed today. The repeated deferrals mean that the JWST, a tremendously ambitious undertaking by any measure, will now cost US taxpayers far more than it should have done. The report rightly lays most of the responsibility for this at NASA's door, but Congress deserves a share of the blame. Political wrangling has consistently constrained the space agency's budget without reducing public and political expectations. As has been seen with planetary exploration and human space flight, this paradox has bred an administrative culture at NASA that discourages realistic budgeting and honest reporting.

The JWST's saving grace is that it seems to be technically sound. Although still years from completion, it stands to become one of the most productive astronomical observatories in history. The 6.5-metre infrared telescope is expected to have roughly six times the light-gathering area of its predecessor, the Hubble Space Telescope. Its gold-coated mirror segments are ideal for probing the atmospheres of planets in distant solar systems and reaching back into the early history of the Universe to capture light from the first stars. Given Hubble's transformational impact on astronomy — and on the wider public's engagement with science — the case for a next-generation, all-purpose space observatory seems as strong as ever. That makes it all the more urgent to launch the JWST in a timely manner. Once Hubble is retired, the JWST will become the crucial tool with which astronomers can follow up on discoveries made by wide-field survey telescopes on the ground and in space.

But no project, however worthy, is too big to fail, and the JWST has now swerved disturbingly close to fiasco. To keep it to its latest price tag will be a painful process that will damage future projects and further erode the space agency's credibility. One casualty could be the proposed Wide Field Infrared Space Telescope (WFIRST), a high-priority mission to study the mysterious 'dark energy' that seems to pervade the Universe. NASA should think again about this project in light of a proposed European mission that would achieve similar results.

The agency might avoid a wholesale gutting of space astrophysics if it concentrates on small-to-medium-sized missions while it clears the JWST from its books. Such missions are exactly what is proposed in a recent decadal survey by the US astronomy community.

Much harder will be the task of re-engineering NASA to avoid a repeat. The independent review makes specific recommendations, which NASA should pursue in earnest. These include better communication between NASA headquarters and the centres where projects are carried out, as well as more frequent independent reviews, which need to become routine. At its best, NASA allows humanity to look towards the stars. To continue doing so, the agency's leadership must keep its feet firmly on the ground.