# Watcher with conditions fails on transform

**URL:** https://discuss.elastic.co/t/watcher-with-conditions-fails-on-transform/147962
**Category:** Elasticsearch
**Tags:** elastic-stack-alerting
**Created:** [September 10, 2018, 12:41pm UTC](https://discuss.elastic.co/t/watcher-with-conditions-fails-on-transform/147962 "2018-09-10T12:41:41Z")
**Posts on this page:** 1
**Showing post:** 5

<div class="post-metadata">

### Author: ![JeffreyH1989](https://avatars.discourse-cdn.com/v4/letter/j/ecb155/32.png) [@JeffreyH1989](https://discuss.elastic.co/u/JeffreyH1989)
#### Post date: [September 13, 2018, 7:37am UTC](https://discuss.elastic.co/t/watcher-with-conditions-fails-on-transform/147962/5 "2018-09-13T07:37:10Z")

</div>

I'm basing it on the json from [Alert when okay](https://discuss.elastic.co/t/alert-when-okay/112707/4)

If you want to try it yourself, you can retrieve the default watcher through the GET api (GET \_xpack/watcher/watch/clusterid\_elasticsearch\_cluster\_status), make it into a watcher, fake the condition and simulate. Then you'll receive the runtime error

```
`"reason": "runtime error",
  "error": {
    "root_cause": [
      {
        "type": "script_exception",
        "reason": "runtime error",
        "script_stack": [
          "ctx.vars.is_new = ctx.vars.fails_check && !ctx.vars.not_resolved;",
          " ^---- HERE"
        ],`
```

---

_[View the full topic](https://discuss.elastic.co/t/watcher-with-conditions-fails-on-transform/147962)._
