# Conditional on process fail

**URL:** <https://community.seqera.io/t/conditional-on-process-fail/2493>\
**Category:** Ask for help\
**Created:** [December 30, 2025, 7:05pm UTC](https://community.seqera.io/t/conditional-on-process-fail/2493 "2025-12-30T19:05:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sav-che](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/sav-che/32/2154_2.png) [@sav-che](https://community.seqera.io/u/sav-che)\
**Post date:** [December 30, 2025, 7:05pm UTC](https://community.seqera.io/t/conditional-on-process-fail/2493/1 "2025-12-30T19:05:43Z")

</div>

Hi! I see ways to execute process B when process A fails by using `branch` or `filter`, but for this a channel `A.out` must exist. Is it possible to do something similar to [this solution](https://community.seqera.io/t/how-to-skip-specific-failed-samples-on-next-resume/2078), but on an absence/presence of channel (i.e., can we distinguish absence of channel caused by the process not yet run and by the process failed)? It feels possible, because nextflow definitely “knows” when a process failed - so can this information be used to trigger another process?

---

<div class="post-metadata">

**Author:** ![sav-che](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/sav-che/32/2154_2.png) [@sav-che](https://community.seqera.io/u/sav-che)\
**Post date:** [January 1, 2026, 2:17pm UTC](https://community.seqera.io/t/conditional-on-process-fail/2493/2 "2026-01-01T14:17:14Z")

</div>

Ok, I think I figured this out 😀

```auto
input_ch = channel.fromPath(params.input) // [val(meta), path(input)]

PROCESS_A(input_ch)

failed_ch = input_ch
    .join(PROCESS_A.out, remainder: true) // [val(meta), path(input), path(output)|null]
    .filter{i -> i[2] == null} // [val(meta), path(input), null]
    .map{i -> return [i[0], i[1]]} // [val(meta), path(input)]

PROCESS_B(failed_ch)

```

---

<div class="post-metadata">

**Author:** ![mahesh.binzerpanchal](https://dub1.discourse-cdn.com/flex013/user_avatar/community.seqera.io/mahesh.binzerpanchal/32/253_2.png) [@mahesh.binzerpanchal](https://community.seqera.io/u/mahesh.binzerpanchal)\
**Post date:** [January 12, 2026, 8:42am UTC](https://community.seqera.io/t/conditional-on-process-fail/2493/3 "2026-01-12T08:42:09Z")

</div>

I’m not so clear on the question, but if you want to a solution to use another channel if one is empty here is one way: [How can I assign a default channel to another channel if it’s empty, while retaining its original content when it’s not empty, considering the default value is also a channel? - #3 by mahesh.binzerpanchal](https://community.seqera.io/t/how-can-i-assign-a-default-channel-to-another-channel-if-it-s-empty-while-retaining-its-original-content-when-it-s-not-empty-considering-the-default-value-is-also-a-channel/1435/3)

Edit: Ah, now I got it. Yes, your solution to use a sentinel value is correct. There’s some examples in the Nextflow Slack if you search for Sentinel.
