# query-missing

The request leaves out its **[EventQL query](/docs/eventsourcingdb/eventql)**.

- **Routes:** `run-eventql-query`, `write-events`, and `format-eventql-query`
- **Description:** `query is missing: expected an EventQL query` when running or formatting a query, and `query is missing: expected an EventQL query whose result is a boolean` for the query of an `isEventQlQueryTrue` precondition
- **Details:** For a precondition, **`precondition`**, the place of the precondition in its list, counting from 0. On the other routes, none; `details` is an empty object.

## Why It Happens

Running a query takes it in **`query`**, and so does the payload of an **[`isEventQlQueryTrue` precondition](/docs/eventsourcingdb/preconditions)**. The request leaves out `query`, or sends it as an **empty string**. A query of nothing but whitespace is not missing: it goes to the parser, which reports it as **[`query-malformed`](/docs/eventsourcingdb/errors/query-malformed)**.

The route `format-eventql-query` belongs to the **[management UI](/docs/eventsourcingdb/management-ui)**, which formats the queries of its EventQL editor through it. It exists **only while the management UI is enabled**, with `--with-ui`, is not part of the stable API, and answers with a single envelope, the error itself, rather than a stream.

## How to Fix It

Send the query in `query`, and for a precondition, one that returns a single boolean. Sending the same request again fails the same way, since the error depends on the request alone.

## Example

To run a query with the body `{}`, 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/query-missing",
    "description": "query is missing: expected an EventQL query",
    "details": {}
  }
}
```
