event-id-missing
The request leaves out an event ID, such as that of a bound or an anchor.
- Routes:
write-events,read-events,observe-events,audit-history, andcreate-backup - Description:
event ID is missing: expected a non-negative integer of at most 9223372036854775807 in a string, such as '42' - Details: When reading or observing events,
bound, the bound that leaves out its ID,lowerBoundorupperBound. When writing events,precondition, the place of the precondition in its list, counting from 0. When auditing the history or creating a backup, none;detailsis an empty object.
Why It Happens#
Several requests name an event by its ID: the lowerBound and upperBound of a read, the lowerBound of an observation, the eventId of an isSubjectOnEventId precondition, and the id of the event that an audit or a backup continues from, in lastAuditedEvent or lastBackedUpEvent. The database reports this error when that ID is left out or is an empty string. A bound is checked for its ID before its type, so a bound that is an empty object reports this error.
A typical cause is an empty object where null is meant: a first audit or a full backup sends null as lastAuditedEvent or lastBackedUpEvent, while {} names an event without its ID.
How to Fix It#
Send the ID of the event as a non-negative integer in a string, without a sign or a leading zero, such as "42", or, for a first audit or a full backup, null in place of the whole event. Sending the same request again fails the same way, since the error depends on the request alone.
Example#
To read the events of /books/42 with a lowerBound that has a type but no ID, 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/event-id-missing",
"description": "event ID is missing: expected a non-negative integer of at most 9223372036854775807 in a string, such as '42'",
"details": {
"bound": "lowerBound"
}
}
}