I doubt it's a bug with libpq 12.2 or whatever server is on the other side of the wire: we would have seen this error more often. If you want to investigate in that direction you may ask core devs if there have been changes in that area for those versions.
My wild guess is either faulty network or faulty memory on the machine, most likely the latter.