# How to make a flow fail (return an error, exception)

**URL:** <https://community.homey.app/t/how-to-make-a-flow-fail-return-an-error-exception/110446>\
**Category:** Flows\
**Tags:** advancedflow\
**Created:** [May 25, 2024, 8:35am UTC](https://community.homey.app/t/how-to-make-a-flow-fail-return-an-error-exception/110446 "2024-05-25T08:35:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bischowski](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bischowski/32/16864_2.png) [@bischowski](https://community.homey.app/u/bischowski)\
**Post date:** [May 25, 2024, 8:35am UTC](https://community.homey.app/t/how-to-make-a-flow-fail-return-an-error-exception/110446/1 "2024-05-25T08:35:57Z")

</div>

Hi Everyone,

how can I make a flow fail, that a calling flow will be aware of the failure.

I have an advanced flow, which I start from another advanced flow (like an subroutine) and when in the subroutine-flow an error occurs, I want to give this back to the calling flow to proceed on the red line.

thanks in advance  
bischowski

---

<div class="post-metadata">

**Author:** ![Rrrr](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/rrrr/32/629_2.png) [@Rrrr](https://community.homey.app/u/Rrrr)\
**Post date:** [May 25, 2024, 8:39am UTC](https://community.homey.app/t/how-to-make-a-flow-fail-return-an-error-exception/110446/2 "2024-05-25T08:39:42Z")

</div>

There are no subroutines.

Best is to call the original flow with for example a number tag that indicates the Error.

The excellent app Advanced Triggers has an option to return values but after trying it, I think the use case does not justify the complication.

---

<div class="post-metadata">

**Author:** ![Andy\_Henderson](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/andy_henderson/32/80642_2.png) [@Andy\_Henderson](https://community.homey.app/u/Andy_Henderson)\
**Post date:** [May 25, 2024, 11:11am UTC](https://community.homey.app/t/how-to-make-a-flow-fail-return-an-error-exception/110446/3 "2024-05-25T11:11:49Z")

</div>

> [@bischowski](#):
>
> I have an advanced flow, which I start from another advanced flow (like an subroutine) and when in the subroutine-flow an error occurs, I want to give this back to the calling flow to proceed on the red line.

You could set a variable in the called routine to indicate success or failure. E.g. set a boolean xxxFailed to true at the start and false at the successful outcome(s). You can then test the variable in the calling routine. I’ve just checked and when a called flow finishes it does return control to the calling flow so you can chain a test of the variable after the call.

For more information, you could use a string variable to store error messages and use ‘success’ to indicate successful completion.

If you don’t get control back in your situation, you could try adding a branch before the call with a delay before testing the variable. A kludge, but it might do what you need.

Andy

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [May 25, 2024, 1:20pm UTC](https://community.homey.app/t/how-to-make-a-flow-fail-return-an-error-exception/110446/4 "2024-05-25T13:20:23Z")

</div>

In 3+ years I’ve never experienced a flow _itself_ fails for unknown reasons  
It’s always:

- me: I did something stupid, like deleting a variable which still was used in a flow
- a variable which got an invalid value somehow
- app crash / paused app: this causes all related flowcards to become unavailable. The flow breaks, and stops functioning, but,  
This wonderful app monitors all those variables, breaks, errors and mistakes and notifies you: **[Flow Checker](https://community.homey.app/t/app-pro-flow-checker/50986)**

Advice: add **[Simple Log](https://community.homey.app/t/app-pro-simple-sys-log-use-this-app-for-simple-sys-logging/77533)** app log cards to each and every part of your flows, to be able to search historical data.  
It even has a [script to add log cards to all flows](https://community.homey.app/t/app-pro-simple-sys-log-use-this-app-for-simple-sys-logging/77533/6).

---

<div class="post-metadata">

**Author:** ![bischowski](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bischowski/32/16864_2.png) [@bischowski](https://community.homey.app/u/bischowski)\
**Post date:** [May 28, 2024, 2:29pm UTC](https://community.homey.app/t/how-to-make-a-flow-fail-return-an-error-exception/110446/5 "2024-05-28T14:29:44Z")

</div>

Well, starting a flow from another flow with text (JSON in this case) seems to be very close to a subroutine/procedure call in my opionion. The start-flow-with-text-card has a error-branch. How to use this branch, when there is no way to make the flow fail/return error state?

But nevertheless, thanks for the feedback. SimpleLog needs to do the job until this might be added in the future.

---

<div class="post-metadata">

**Author:** ![Peter\_Kawa](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/peter_kawa/32/173848_2.png) [@Peter\_Kawa](https://community.homey.app/u/Peter_Kawa)\
**Post date:** [May 28, 2024, 5:51pm UTC](https://community.homey.app/t/how-to-make-a-flow-fail-return-an-error-exception/110446/6 "2024-05-28T17:51:48Z")

</div>

> [@bischowski](#):
>
> The start-flow-with-text-card has a error-branch. How to use this branch, when there is no way to make the flow fail/return error state?
> 
> Simple log needs to do the job until this might be added in the future.

Grab your chance here, and ask why its absent, and/or propose what you’d like to see:

> [@Ten years of Homey — Ask Me Anything speech\_balloon](https://community.homey.app/t/ten-years-of-homey-ask-me-anything/110598):
>
> Ten years of Homey — Ask Me Anything speech_balloon Today is our tenth birthday! partying_face To celebrate, we’ll host an AMA (Ask Me Anything) livestream on Monday June 3rd, 19:00 CEST. This is a nice opportunity to ask anything to Athom’s founders: Stefan (Commercial Director) and Emile (Creative Director). Make sure to set a reminder on YouTube so you won’t miss it! bell If you can’t make it, reply your question to this topic, and we’ll try to answer it during the livestream. …

---

<div class="post-metadata">

**Author:** ![bischowski](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/bischowski/32/16864_2.png) [@bischowski](https://community.homey.app/u/bischowski)\
**Post date:** [May 28, 2024, 7:10pm UTC](https://community.homey.app/t/how-to-make-a-flow-fail-return-an-error-exception/110446/7 "2024-05-28T19:10:41Z")

</div>

> [@Peter\_Kawa](#):
>
> Grab your chance here, and ask why its absent, and/or propose what you’d like to see:

There are a lot more important things to do for athom. Many of them are already asked. I will try to find the time to join the event, but … hmm, how to say. Even though I love homey for many years, I’m not a athom fanboy. Even if they created an amazing product, I don’t like their closed doors politics and the way they handle problems.
