Sequence number (X11)
The silent running count attached to every X request, and the only way to match an error to the call that caused it.
Requests carry no number on the wire. Client and server each keep count — the first request after connection setup is number 1 — and the server stamps every reply, event and error with the low 16 bits of the last request it processed. Since most calls have no reply and are sent in batches, that number is what lets Xlib say which call an asynchronous error belonged to.
It shows up in the classic dump from Xlib's error handler: "Serial number of failed request" next to "Current serial number in output stream", often hundreds of requests apart. Sixteen bits only go to 65,536, so Xlib keeps a wider counter and infers the high bits. If a program sends more requests than that without hearing back from the server, the inference breaks and Xlib complains about "sequence lost". XCB keeps things straight by handing out a cookie for every request with a reply, and the cookie remembers its number.