USA to UK is a DHS requirement to scan, it's used to determine your length of stay since you appeared at CBP and replaces the cards stapled into passports after arrival. If you check-in luggage the passport is scanned there, some places they can do it in the lounge (SFO, JFK, BOS for example) other places they do it at the gate to anyone who is HBO. Some places with high transfer numbers - ORD, PHL - go to some effort to identify people who need scanning well before boarding since the system can't cope with too many people being scanned at the gate in time for boarding, given the new biometric boarding process.
Elsewhere:
Generally if FLY holds incorrect or missing passport details then it will give this message on non CTA flights, so the OP may want to check their profile / API to ensure there isn't a missing piece of data / month-date swap and the like. It's not inefficient to do it at the gate, but if it happens every place in say Europe then that is the reason.