Docs / EventSourcingDB / Errors / if-event-is-missing-unknown

if-event-is-missing-unknown

ifEventIsMissing has a value that the route does not accept.

  • Routes: read-events and observe-events
  • Description:
    • for read-events: ifEventIsMissing is unknown: expected 'read-everything' or 'read-nothing'
    • for observe-events: ifEventIsMissing is unknown: expected 'read-everything' or 'wait-for-event'
  • Details: value, the value as the request gave it.

Why It Happens#

ifEventIsMissing says what a read or an observation with fromLatestEvent does if the subject has no event of the given type. Both routes accept read-everything, which starts at the first event instead. The other value differs between the routes: reading accepts read-nothing, which ends the read without events, and observing accepts wait-for-event, which waits until such an event is written.

So the typical cause is the value of the other route: wait-for-event when reading, or read-nothing when observing. The values are case-sensitive as well. A fromLatestEvent that leaves out ifEventIsMissing, or sends it as an empty string, is reported as from-latest-event-incomplete.

How to Fix It#

When reading, send read-everything or read-nothing; when observing, send read-everything or wait-for-event. Sending the same request again fails the same way.

Example#

To read the events of /books/42 from its latest io.eventsourcingdb.library.book-borrowed event, with ifEventIsMissing set to wait-for-event, 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/if-event-is-missing-unknown",
    "description": "ifEventIsMissing is unknown: expected 'read-everything' or 'read-nothing'",
    "details": {
      "value": "wait-for-event"
    }
  }
}