# Evaluation failed

Resolve evaluation failed errors.

The [CQL](/reference/cql/introduction) expression is syntactically valid but cannot be evaluated at runtime.

Common causes include accessing an undefined variable, performing an invalid operation such as division by zero, or referencing a missing node.

## 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/evaluation-failed",
  "title": "The evaluation failed.",
  "status": 422,
  "detail": "The query could not be evaluated due to a runtime error.",
  "errors": [
    {
      "cause": "The divisor cannot be zero.",
      "location": {
        "start": {
          "line": 1,
          "column": 0,
          "index": 0
        },
        "end": {
          "line": 1,
          "column": 5,
          "index": 5
        }
      }
    }
  ]
}
```

The response includes the following additional field. The `location` is included only when the failed node has source location information available.

- `errors`: `Array<object>`

  The list of errors found while processing the expression.

  - `cause`: `string`

    A human-readable description of the error.

  - `location`: `object` (optional)

    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`.
