# Kapacitor alert and restart a task which has hit an error

**URL:** <https://community.influxdata.com/t/kapacitor-alert-and-restart-a-task-which-has-hit-an-error/14939>\
**Category:** Systems\
**Tags:** kapacitor\
**Created:** [June 22, 2020, 3:34pm UTC](https://community.influxdata.com/t/kapacitor-alert-and-restart-a-task-which-has-hit-an-error/14939 "2020-06-22T15:34:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lee](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/lee/32/5205_2.png) [@lee](https://community.influxdata.com/u/lee)\
**Post date:** [June 22, 2020, 3:34pm UTC](https://community.influxdata.com/t/kapacitor-alert-and-restart-a-task-which-has-hit-an-error/14939/1 "2020-06-22T15:34:49Z")

</div>

Hi,

I have a python UDF task which was working for a few days before it hit an exception. To summarise the task looks at the “x-forwarded-for” headers and does a geo-lookup on the address contained within. However when we received two addresses which is a valid header, the code didn’t account for that scenario and failed, which took a couple of days to notice.

So this has raised two questions:

1. Is it possible to receive alerts on a Kapacitor task which enters the “Executing: false” state?
2. Can Kapacitor automatically restart a failed task?

We have updated our UDF to account for the problem scenario but it would be nice to catch any similar situations sooner.

Thanks  
Lee

---

<div class="post-metadata">

**Author:** ![Usul](https://avatars.discourse-cdn.com/v4/letter/u/e9bcb4/32.png) [@Usul](https://community.influxdata.com/u/Usul)\
**Post date:** [June 23, 2020, 10:39am UTC](https://community.influxdata.com/t/kapacitor-alert-and-restart-a-task-which-has-hit-an-error/14939/2 "2020-06-23T10:39:27Z")

</div>

for me when I had badly written some tick - they went from enabled to disabled.  
re-enabling them was unfortunately a manual task.
