The UK’s spending watchdog has warned the Government’s post-Brexit IT system for customs is heading for a “horror show” that could risk £34bn of public income.

In a scathing assessment, the National Audit Office said the computer system might not be ready by the time Britain leaves the EU, potentially plunging the UK’s ports into chaos.

The £157m system is due to be completed just two months before Brexit in March 2019, but the NAO says delays common to new IT would cause massive disruption.

In unusually tough language, auditor general Sir Amyas Morse said ministers were only beginning to understand the momentous task of Brexit and that without further resources would find that “at the first tap, this falls apart like a chocolate orange”.

The full complexity of Brexit became starker still after the Government 's approach to the EU’s nuclear agency was thrown into chaos, amid claims it would risk cancer treatments.

Ministers are also due to publish papers setting out their negotiating positions and their key piece of Brexit legislation on Thursday, the Repeal Bill, starting a two-year push to force through a complicated legislative programme on a wafer thin Commons majority.

Publishing his report on the Customs Declaration Service, Sir Amyas said the IT system to record declarations on imports and exports threatened to become “a horror show”.

He explained that it is “well regarded”, but not considered flexible enough to cope with new rules after Brexit.

He went on: “At the moment it's due to deliver just two months before the EU deadline ... Our view in this report is that there is very little flexibility, should the programme overrun or unexpected problems occur. There are plenty of such problems that could occur.

“We're not telling you this is a badly run project but, to be frank, looking at IT projects with still considerable technical challenges not yet resolved in them, we kind of know that it’s normal for there to be some drift in time.

“What’s unique about these circumstances is there can’t be a drift in timescale. Normally if you have this project and it took another six months to be a working project you’d say this is a pretty successful project. But this is not like that.”

Among risks outlined in the NAO’s report is the possibility that Britain’s final deal with the EU might require features in the IT system not yet anticipated by its designers – requiring last minute changes and causing more delays.

David Davis said customs checks would be ready (AP)

The watchdog also says that parts of the system are untested at the scale the UK is using them, and that there are “significant gaps in staff resources”, with 48 vacancies on the project at the end of June 2017.

The Government wants to migrate from the old customs computer system starting in August 2018 and finish in January 2019. Under Article 50 the UK will leave the EU automatically just eight weeks later.

Sir Amyas said that without any contingency plans, delays and problems could mean taxes at the border going uncollected, with queues of lorries and additional damage to business confidence and Britain’s reputation as a trading nation.

In a worst-case scenario it would become impossible to collect the £34bn of duty, excise, and VAT taken at the border every year.

Supreme Court Brexit Challenge Show all 13 1 /13 Supreme Court Brexit Challenge Supreme Court Brexit Challenge People wait to enter the public gallery outside the Supreme Court ahead of the challenge against a court ruling that Theresa May's government requires parliamentary approval to start the process of leaving the European Union, in Parliament Square, central London Reuters Supreme Court Brexit Challenge Gina Miller, co-founder of investment fund SCM Private arrives at the Supreme court in London on the first day of a four-day hearing Getty Supreme Court Brexit Challenge A man waves the EU flag in front of the Supreme Court Getty Supreme Court Brexit Challenge Satirical artist Kaya Mar poses with two of his paintings in front of the Supreme Court Getty Supreme Court Brexit Challenge Pro-Europe protestors dressed as Supreme Court Justices stand outside the Supreme Court ahead of the first day of a hearing into whether Parliament's consent is required before the Brexit process can begin. The eleven Supreme Court Justices will hear the government's appeal, following the High Court's recent decision that only Parliament can trigger Article 50 Getty Supreme Court Brexit Challenge The eleven Supreme Court Justices will hear the government's appeal, following the High Court's recent decision that only Parliament can trigger Article 50 Getty Supreme Court Brexit Challenge Businesswoman Gina Miller arrives at the Supreme Court ahead of the first day of a hearing into whether Parliament's consent is required before the Brexit process can begin Getty Supreme Court Brexit Challenge Attorney General Jeremy Wright arrives at the Supreme Court in London EPA Supreme Court Brexit Challenge Protesters outside the Supreme Court in London, where the Government is appealing against a ruling that the Prime Minister must seek MPs' approval to trigger the process of taking Britain out of the European Union PA wire Supreme Court Brexit Challenge A protesters wearing a judge's wigs and robes stands outside the Supreme Court ahead of the challenge against a court ruling that Theresa May's government requires parliamentary approval to start the process of leaving the European Union, in Parliament Square, central London Reuters Supreme Court Brexit Challenge A protester holds up a placard outside the Supreme Court ahead of the challenge against a court ruling that Theresa May's government requires parliamentary approval to start the process of leaving the European Union, in Parliament Square, central London Reuters Supreme Court Brexit Challenge Pro-Europe protestors dressed as Supreme Court Justices stand outside the Supreme Court Getty Supreme Court Brexit Challenge A man waiting to enter the public gallery waves a European Union flag outside the Supreme Court ahead of the challenge against a court ruling that Theresa May's government requires parliamentary approval to start the process of leaving the European Union, in Parliament Square, central London Reuters

He said Brexit it is the biggest peacetime challenge to government but that was “only just beginning to click into people's awareness in government”.

“It needs to act as far as possible in a unified way and we have an issue there because of departmental government,” he added.

“What we don't want to find is that, at the first tap, this falls apart like a chocolate orange. It needs to be coming through as uniform, a little bit more like a cricket ball.”

The programme is currently rated “amber” by the Major Projects Authority, which means it has “significant issues” requiring management attention immediately.

Michel Barnier encourages the UK to make haste in the Brexit negotiations

Sir Aymas called for Government to ensure HM Revenue & Customs had the support from across Government to finish the computer system. He also reiterated a warning that the capacity of Whitehall and Parliament would be all but preoccupied with Brexit over the next few years.

He went on: “A year ago I gave a speech at the Institute of Government that said the Government’s programme was already overloaded before the EU vote.

“It had massive challenges and it needed to recognise that the civil service couldn't handle just about anything that was thrown at it. It needed to prioritise and focus its resources on things that really mattered to it.”

Sir Aymas added: “There’s not been a particular rousing response to that, I’ve got to say.”

Vince Cable: 'I'm beginning to think Brexit may never happen'

Brexit Secretary David Davis yesterday struck a more optimistic tone, suggesting the biggest problem in the transition was for other countries to deal with.

“I believe we can get a free trade negotiation concluded and a customs union agreement concluded in the [Brexit negotiating] period; what will be much more difficult however is to get all the practical implementations that go with it.

“It will be quite tough to get customs in the right place in two years but it’s doable with a bit of money, but to get the French customs in the same place in two years or the Belgian or the Dutch customs I think will be a different issue, that’s why a transition period [is needed].”

In another sign the Government may have misjudged the difficulty of Brexit, it faced a growing backlash against its decision to leave the EU atomic agency Euratom.

Ms May's deputy Damian Green dismissed doctors’ warnings that radioactive isotopes used in cancer treatments may no longer be available as “scaremongering”, but was immediately accused by the Nuclear Industry Association of misleading MPs.