# Invalid query

Resolve invalid query errors.

The [CQL](/reference/cql/introduction) expression contains one or more syntax errors.

Verify the expression syntax against the [CQL reference](/reference/cql/introduction) before retrying.

## Response

All error responses follow the [Problem Details (RFC 9457)](/reference/api/overview#errors) format. The `type`, `title`, `status`, and `detail` fields are always present, while `instance` may be omitted depending on the API.

Here is an example of the response returned for this error:

```json
{
  "type": "https://croct.help/api/evaluation/invalid-query",
  "title": "The query is invalid.",
  "status": 422,
  "detail": "The query contains one or more syntax errors.",
  "errors": [
    {
      "cause": "No viable alternative at the end of input",
      "location": {
        "start": {
          "line": 1,
          "column": 3,
          "index": 3
        },
        "end": {
          "line": 1,
          "column": 3,
          "index": 3
        }
      }
    }
  ]
}
```

The response includes the following additional field:

- `errors`: `Array<object>`

  The list of errors found while processing the expression.

  - `cause`: `string`

    A human-readable description of the error.

  - `location`: `object`

    The source location of the error within the expression.

    - `start`: `object`

      The start position of the problematic token.

      - `line`: `integer`

        The 1-based line number.

      - `column`: `integer`

        The 0-based column number within the line.

      - `index`: `integer`

        The 0-based character offset from the start of the expression.

    - `end`: `object`

      The end position of the problematic token, with the same shape as `start`.
