# payload-missing

A **[precondition](/docs/eventsourcingdb/preconditions)** leaves out its **payload**.

- **Route:** `write-events`
- **Description:** `payload is missing: expected an object with the values of the precondition`
- **Details:** **`precondition`**, the place of the precondition in its list, counting from 0.

## Why It Happens

A precondition carries the values it checks in its **`payload`**: the `subject` for `isSubjectPristine` and `isSubjectPopulated`, the `subject` and the `eventId` for `isSubjectOnEventId`, and the `query` for `isEventQlQueryTrue`. A precondition of a known type **without a payload**, such as `{ "type": "isSubjectPristine" }`, has nothing to check.

A payload that is there but lacks a value is reported by that value, for example as **[`subject-missing`](/docs/eventsourcingdb/errors/subject-missing)** or **[`query-missing`](/docs/eventsourcingdb/errors/query-missing)**. A payload that is `null` is rejected with `400 Bad Request`, since the body then does not have the shape the route expects.

## How to Fix It

Add the payload, with the values that the **[type of the precondition](/docs/eventsourcingdb/preconditions#available-precondition-types)** takes. Sending the same request again fails the same way, since the error depends on the request alone.

## Example

For a write whose only precondition is an `isSubjectPristine` without a payload, EventSourcingDB answers with this error, as a line of the stream, and then ends the stream with its `end` item:

```json
{
  "type": "error",
  "data": {
    "code": "https://docs.eventsourcingdb.io/errors/payload-missing",
    "description": "payload is missing: expected an object with the values of the precondition",
    "details": {
      "precondition": 0
    }
  }
}
```
