last-backed-up-event-unknown
The database holds no event with the ID that lastBackedUpEvent names.
- Route:
create-backup - Description:
last backed up event is unknown: the store holds no event with its ID - Details:
value, the ID oflastBackedUpEventas the request gave it.
Why It Happens#
An increment of a backup follows on the event the previous backup ended at. So before it sends anything, EventSourcingDB looks up the event with the ID that lastBackedUpEvent names. Here, the database has no such event: it holds no events at all, or its latest event has a lower ID.
Events are never removed, so this usually means that the request goes to another database than the one the previous backup was created from, such as a new one, or that the database was restored from an older backup since. If the database holds the event, but with another hash, EventSourcingDB reports last-backed-up-event-mismatched instead.
How to Fix It#
Send the request to the database the previous backup was created from. If the backups no longer fit the database, start anew with a full backup, with lastBackedUpEvent set to null. Resending the request to this database fails the same way, as long as it holds no event with that ID.
Example#
For an increment whose lastBackedUpEvent names the event 41, sent to a database whose latest event is 23, 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-backed-up-event-unknown",
"description": "last backed up event is unknown: the store holds no event with its ID",
"details": {
"value": "41"
}
}
}