# How to detect "stall" in Lua script

**URL:** <https://forum.farmbot.org/t/how-to-detect-stall-in-lua-script/9681>\
**Category:** Software\
**Created:** [February 27, 2025, 8:03pm UTC](https://forum.farmbot.org/t/how-to-detect-stall-in-lua-script/9681 "2025-02-27T20:03:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nbourre](https://forum.farmbot.org/letter_avatar_proxy/v4/letter/n/7993a0/32.png) [@nbourre](https://forum.farmbot.org/u/nbourre)\
**Post date:** [February 27, 2025, 8:03pm UTC](https://forum.farmbot.org/t/how-to-detect-stall-in-lua-script/9681/1 "2025-02-27T20:03:36Z")

</div>

I broke a seeding needle because the robot seems to have stalled at some point and lost its home position. It then continued the script. I would like to prevent this in my code.

How to detect stalling in lua to make the robot stop or do something else? Somekind of event listener.

Thank you

---

<div class="post-metadata">

**Author:** ![jsimmonds](https://forum.farmbot.org/user_avatar/forum.farmbot.org/jsimmonds/32/1470_2.png) [@jsimmonds](https://forum.farmbot.org/u/jsimmonds)\
**Post date:** [February 28, 2025, 11:11am UTC](https://forum.farmbot.org/t/how-to-detect-stall-in-lua-script/9681/2 "2025-02-28T11:11:11Z")

</div>

Hi @nbourre I think the Sequence block **ASSERTION** is for just this purpose !  
(no event listeners)

[Advanced Commands | FarmBot Software Documentation](https://software.farm.bot/v15/app/sequences/sequence-commands/advanced)

---

<div class="post-metadata">

**Author:** ![nbourre](https://forum.farmbot.org/letter_avatar_proxy/v4/letter/n/7993a0/32.png) [@nbourre](https://forum.farmbot.org/u/nbourre)\
**Post date:** [February 28, 2025, 2:15pm UTC](https://forum.farmbot.org/t/how-to-detect-stall-in-lua-script/9681/3 "2025-02-28T14:15:03Z")

</div>

I’m not sure how I could integrate an assertion block into a lua block. Unless, I must run an assertion block instead of a lua one which would be quite counterintuitive.

Where can we make feature request? An error callback function in any movement related functions would be quite useful.

---

<div class="post-metadata">

**Author:** ![jsimmonds](https://forum.farmbot.org/user_avatar/forum.farmbot.org/jsimmonds/32/1470_2.png) [@jsimmonds](https://forum.farmbot.org/u/jsimmonds)\
**Post date:** [March 1, 2025, 2:12am UTC](https://forum.farmbot.org/t/how-to-detect-stall-in-lua-script/9681/4 "2025-03-01T02:12:57Z")

</div>

> [@nbourre](#):
>
> Where can we make feature request?

Open a new post in this forum and enter it into the **Feature Requests** category, or, if you have a GitHub account then open a new Issue on the **farmbot\_os** repository and mark it clearly as a Feature Request 🙂

> [@nbourre](#):
>
> An error callback function in any movement related functions would be quite useful.

The FarmbotOS code which executes our Sequence (a temporary Erlang process) is strictly single-threaded (by design) and does not use Events so any callback facility gains you not much.  
I’m sure @roryaronson will set our thinking straight on this question 😜

---

<div class="post-metadata">

**Author:** ![system](https://forum.farmbot.org/user_avatar/forum.farmbot.org/system/32/4564_2.png) [@system](https://forum.farmbot.org/u/system)\
**Post date:** [March 31, 2025, 2:12am UTC](https://forum.farmbot.org/t/how-to-detect-stall-in-lua-script/9681/5 "2025-03-31T02:12:58Z")

</div>

Closed on March 31, 2025, 2:12am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
