# last-audited-event-missing

The request leaves out **`lastAuditedEvent`**, which is `null` for a first audit.

- **Route:** `audit-history`
- **Description:** `last audited event is missing: expected the ID and hash of the event the previous audit ended at, or null for a first audit`
- **Details:** None; `details` is an empty object.

## Why It Happens

An **[audit](/docs/eventsourcingdb/auditing-the-event-store)** checks the chain of events and, with **`lastAuditedEvent`**, that the event the previous audit ended at is still the same. It takes the `id` and the `hash` of that event, as the previous audit answered them in its `lastAuditedEvent` item, or `null` for a first audit. A body that leaves it out, such as `{}`, is refused rather than taken for a first audit, so that **an audit that lost its anchor does not skip that check** without notice.

## How to Fix It

Send `lastAuditedEvent` with the `id` and `hash` from the result of the previous audit, or `null` if there was none. An audit of a database without events answers no `lastAuditedEvent` item, so the next audit sends `null` as well. Sending the same request again fails the same way.

## Example

For an audit whose body is `{}`, 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/last-audited-event-missing",
    "description": "last audited event is missing: expected the ID and hash of the event the previous audit ended at, or null for a first audit",
    "details": {}
  }
}
```
