More than 3,200 US prisoners have been released early because of a software glitch.
The bug miscalculated the sentence reductions prisoners in Washington state had received for good behaviour.
It was introduced in 2002 as part of an update that followed a court ruling about applying good behaviour credits.
State officials said that many early-release prisoners would have to return to jail to finish their sentences.
“That this problem was allowed to continue for 13 years is deeply disappointing to me, totally unacceptable and, frankly, maddening,” said Washington’s governor Jay Inslee at a press conference.
The Washington Department of Corrections (DoC) added that it was made aware of the problem in 2012 when the family of one victim found out that the offender was getting out too early.
Despite this, the faulty software was not corrected until a new IT boss for the DoC was appointed, who realised how serious the problem had become.
The manager then informed senior staff at the DoC and the governor’s office.
Analysis of the errors showed that, on average, prisoners whose sentences were wrongly calculated got out 49 days early. One prisoner had his sentence cut by 600 days. It is not known if any offender committed further crimes after being released prematurely.
Local police are now helping to round up those who still need to spend time in jail. Five people have already been returned to cells.
Mr Inslee said he had ordered the DoC to fix the software as quickly as possible.
An update that applies the correct formula for calculating sentence cuts is due to be in place by 7 January.