A code error in the NHS Covid-19 app meant users had to be next to a highly infectious patient for five times as long as the NHS had decided was risky before being instructed to self-isolate, the Guardian has learned.

The oversight in the app meant thousands of people were told they did not need to quarantine when they were in fact at risk of spreading coronavirus.

The problem was only discovered last week, when software engineers rewrote how the app decides who needs to isolate and discovered it had been relying on faulty maths since its launch in September. According to the Sunday Times, which reported on the flaw, a source said the fault meant that a “shockingly low” number of warnings were issued.

Despite claiming more than 19m downloads of the app, which is for use in England and Wales, the UK government has continually declined to reveal how many users have been advised to isolate. In Scotland and Northern Ireland, where similar apps have fewer users, more than 25,000 people have been warned of their possible exposure to the virus.

A Department for Health and Social Care (DHSC) spokesperson said the England and Wales version was “the only app in the world using the latest Google-Apple technology to better gauge distance to identify those most at risk, and is deemed ‘excellent’ by international standards.

“We anticipate more app users who are at high risk of having caught the virus will receive a notification to self-isolate, and that will be to everyone’s long term benefit by reducing the chances of those with the virus passing it on to others. We are very clear, everyone who is contacted will have been in close contact with someone who has a confirmed case of COVID-19.”