# Illegal\_state\_exception when registering/updating watches

**URL:** <https://discuss.elastic.co/t/illegal-state-exception-when-registering-updating-watches/35136>\
**Category:** Elasticsearch\
**Tags:** elastic-stack-alerting\
**Created:** [November 20, 2015, 9:29am UTC](https://discuss.elastic.co/t/illegal-state-exception-when-registering-updating-watches/35136 "2015-11-20T09:29:20Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mcku](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mcku/32/33775_2.png) [@mcku](https://discuss.elastic.co/u/mcku)\
**Post date:** [November 20, 2015, 9:29am UTC](https://discuss.elastic.co/t/illegal-state-exception-when-registering-updating-watches/35136/1 "2015-11-20T09:29:20Z")

</div>

On a trial installation, watches were working fine till yesterday, but today we get an error. Elastic cluster and Kibana is up and running. On the sense console, whenever I try to DELETE or PUT a watch I get (I had to type it, sorry if typos are present or if not a valid JSON 😉

```
{
    "error": {
        "root_cause": [
            "type": "illegal_state_exception",
            "reason": "not started"
        ],
        "type": "illegal_state_exception",
        "reason": "not started"
    },
    "status": 500
}

```

`GET _watcher/watch/myWatch` --\> OK

`PUT _watcher/watch/myWatch` --\> failing, but was working fine till yesterday  
`DELETE _watcher/watch/myWatch` --\> failing, but was working fine till yesterday

Any ideas on how to fix it?

---

<div class="post-metadata">

**Author:** ![cbuescher](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/cbuescher/32/60402_2.png) [@cbuescher](https://discuss.elastic.co/u/cbuescher)\
**Post date:** [November 20, 2015, 11:46am UTC](https://discuss.elastic.co/t/illegal-state-exception-when-registering-updating-watches/35136/2 "2015-11-20T11:46:59Z")

</div>

Hi, just wanted to let you know there is a special section of the forum dedicated to [Watcher](https://discuss.elastic.co/c/watcher). You might want to try your question there as well.

---

<div class="post-metadata">

**Author:** ![mcku](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mcku/32/33775_2.png) [@mcku](https://discuss.elastic.co/u/mcku)\
**Post date:** [November 20, 2015, 11:58am UTC](https://discuss.elastic.co/t/illegal-state-exception-when-registering-updating-watches/35136/3 "2015-11-20T11:58:18Z")

</div>

@cbuescher Thank you. I will post another one on the watcher forum. Please disregard this post.

---

<div class="post-metadata">

**Author:** ![mcku](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mcku/32/33775_2.png) [@mcku](https://discuss.elastic.co/u/mcku)\
**Post date:** [November 20, 2015, 12:08pm UTC](https://discuss.elastic.co/t/illegal-state-exception-when-registering-updating-watches/35136/4 "2015-11-20T12:08:53Z")

</div>

Moved to Watcher category.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [November 30, 2015, 5:45am UTC](https://discuss.elastic.co/t/illegal-state-exception-when-registering-updating-watches/35136/5 "2015-11-30T05:45:09Z")

</div>

Hey,

which elasticsearch version are you using? Do you see additional information in the log files? Like a stack trace for example?

--Alex

---

<div class="post-metadata">

**Author:** ![mcku](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mcku/32/33775_2.png) [@mcku](https://discuss.elastic.co/u/mcku)\
**Post date:** [December 4, 2015, 1:46pm UTC](https://discuss.elastic.co/t/illegal-state-exception-when-registering-updating-watches/35136/6 "2015-12-04T13:46:00Z")

</div>

Hi,

That was ES2.0.

It was apparently due to too many watches being in the execution queue, and I guess that's the reason why PUT and DELETE did not work. It was in a loop such that as new watches pop up the overall situation was unstable. I had to fix it in a hard way 😉

That was a trial so did not matter but be careful about the trigger intervals.

---

<div class="post-metadata">

**Author:** ![mvg](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mvg/32/98890_2.png) [@mvg](https://discuss.elastic.co/u/mvg)\
**Post date:** [December 4, 2015, 2:12pm UTC](https://discuss.elastic.co/t/illegal-state-exception-when-registering-updating-watches/35136/7 "2015-12-04T14:12:24Z")

</div>

Maybe this helps if this happens again: If you can't delete a watch because it continuously being used. You can also delete via the delete watch api by using the `force` option in the query string.

---

<div class="post-metadata">

**Author:** ![rastro](https://avatars.discourse-cdn.com/v4/letter/r/b782af/32.png) [@rastro](https://discuss.elastic.co/u/rastro)\
**Post date:** [October 21, 2016, 5:11pm UTC](https://discuss.elastic.co/t/illegal-state-exception-when-registering-updating-watches/35136/8 "2016-10-21T17:11:33Z")

</div>

Might want to add this info to [the doc](https://www.elastic.co/guide/en/watcher/current/api-rest.html#api-rest-delete-watch), especially since you didn't give an example (?force and ?force=true don't work).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:42pm UTC](https://discuss.elastic.co/t/illegal-state-exception-when-registering-updating-watches/35136/9 "2017-07-06T13:42:25Z")

</div>


