# .OnFinalFailure(...) option

**URL:** <https://discuss.hangfire.io/t/onfinalfailure-option/2307>\
**Category:** feature\
**Created:** [August 11, 2016, 4:17pm UTC](https://discuss.hangfire.io/t/onfinalfailure-option/2307 "2016-08-11T16:17:31Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![Justin\_Hunter](https://avatars.discourse-cdn.com/v4/letter/j/b5ac83/32.png) [@Justin\_Hunter](https://discuss.hangfire.io/u/Justin_Hunter)\
**Post date:** [September 16, 2016, 1:55am UTC](https://discuss.hangfire.io/t/onfinalfailure-option/2307/3 "2016-09-16T01:55:32Z")

</div>

Perhaps it is a bug, however ContinueWith does not fire, even with OnAnyFinishedState if the parent job failed.

I have tried many things to determine final failure - and all ended in failure. Hangfire is missing this crucial state.

I have attempted to tie into OnStateElection, however Hangfire will elect a failed state only to reschedule it again (if max attempts has not been reached) therefore that solution cannot work.

I have attempted the solution above however it does not queue - only sits at awaiting with ‘parent failed’  
`BackgroundJob.ContinueWith(scheduleTaskKey, () => new Temporary().Execute(scheduleTaskKey), JobContinuationOptions.OnAnyFinishedState);`

 ![](https://europe1.discourse-cdn.com/flex017/uploads/hangfire/original/1X/14864a9703200863db8bcdac8ae66cadafd470f0.png)

I will attempt to create a RecurringJob in order to find any failed tasks, do what I need to do with them, then set them to deleted status however I feel this would be a very important feature.

---

_[View the full topic](https://discuss.hangfire.io/t/onfinalfailure-option/2307)._
