subject-missing
The request leaves out a subject.
- Routes:
write-events,read-events,observe-events, andread-subjects - Description:
subject is missing: expected a slash-separated path such as '/books/42' - Details: When writing events,
eventorprecondition, the place of the event or the precondition in its list, counting from 0. On the other routes, none;detailsis an empty object.
Why It Happens#
Every event has a subject, and reading events, observing them, and reading subjects start from one. The database reports this error when subject is left out or is an empty string: at the top level of a read, an observation, or a listing of subjects, in an event of a write, or in the payload of an isSubjectPristine, isSubjectPopulated, or isSubjectOnEventId precondition.
A typical cause is a read that leaves out the subject to get every event. That takes the root subject / with recursive set, see Reading All Events. A fromLatestEvent without its subject is reported as from-latest-event-incomplete instead.
How to Fix It#
Send the subject as a slash-separated path, such as /books/42, or as / together with recursive to cover every subject. Sending the same request again fails the same way, since the error depends on the request alone.
Example#
For a write whose second event leaves out its subject, 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/subject-missing",
"description": "subject is missing: expected a slash-separated path such as '/books/42'",
"details": {
"event": 1
}
}
}