last-audited-event-unknown
The database holds no event with the ID that lastAuditedEvent names.
- Route:
audit-history - Description:
last audited event is unknown: the store holds no event with its ID - Details:
value, the ID oflastAuditedEventas the request gave it.
Why It Happens#
An audit checks every event up to the latest one at its start, and none of them has the ID of lastAuditedEvent: the ID lies above the latest event, or the database holds no events at all. This happens, for example, when the anchor comes from another database, or when the database was restored from a backup that ends before that event.
The error is reported only after the whole chain was checked, so a broken chain is reported first, as event-chain-broken.
How to Fix It#
Check that the anchor is the one the previous audit of this database answered. Sending the same request again fails the same way as long as the database holds no event with that ID.
Example#
For an audit anchored at the event 120 of a database whose latest event is 99, EventSourcingDB answers with this error, as a line of the stream, and then ends the stream with its end item:
{
"type": "error",
"data": {
"code": "https://docs.eventsourcingdb.io/errors/last-audited-event-unknown",
"description": "last audited event is unknown: the store holds no event with its ID",
"details": {
"value": "120"
}
}
}