# Action server exception handling

**URL:** <https://forum.rasa.com/t/action-server-exception-handling/14815>\
**Category:** Rasa Open Source\
**Created:** [August 26, 2019, 1:16pm UTC](https://forum.rasa.com/t/action-server-exception-handling/14815 "2019-08-26T13:16:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![im-singh](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/im-singh/32/4277_2.png) [@im-singh](https://forum.rasa.com/u/im-singh)\
**Post date:** [August 26, 2019, 1:16pm UTC](https://forum.rasa.com/t/action-server-exception-handling/14815/1 "2019-08-26T13:16:22Z")

</div>

I want to know about way to handle exception when action server is not running. I want to tell user to wait or a error. Please tell me any suggestion.

---

<div class="post-metadata">

**Author:** ![Tanja](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tanja/32/4696_2.png) [@Tanja](https://forum.rasa.com/u/Tanja)\
**Post date:** [August 28, 2019, 1:54pm UTC](https://forum.rasa.com/t/action-server-exception-handling/14815/2 "2019-08-28T13:54:21Z")

</div>

If the action server is not running and Rasa is trying to run a custom action, it will receive an error that is catched here: [rasa/action.py at master · RasaHQ/rasa · GitHub](https://github.com/RasaHQ/rasa/blob/master/rasa/core/actions/action.py#L431). Finally, the raised exception will be catched here: [rasa/processor.py at master · RasaHQ/rasa · GitHub](https://github.com/RasaHQ/rasa/blob/master/rasa/core/processor.py#L466). No action is executed and no event is added to the tracker. We just log the error.

So, unfortunately you cannot catch the error and handle it differently.

---

<div class="post-metadata">

**Author:** ![im-singh](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/im-singh/32/4277_2.png) [@im-singh](https://forum.rasa.com/u/im-singh)\
**Post date:** [August 28, 2019, 3:19pm UTC](https://forum.rasa.com/t/action-server-exception-handling/14815/3 "2019-08-28T15:19:05Z")

</div>

I am getting multiple responses from Facebook messenger when my server starts from off. Can I handle the requests in Rasa. I think it sending multiple requests when server is starting that’s why gives multiple responses.

---

<div class="post-metadata">

**Author:** ![Tanja](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/tanja/32/4696_2.png) [@Tanja](https://forum.rasa.com/u/Tanja)\
**Post date:** [August 29, 2019, 6:19am UTC](https://forum.rasa.com/t/action-server-exception-handling/14815/4 "2019-08-29T06:19:45Z")

</div>

What request are you talking about? As far as I know we only handle incoming user messages from Facebook. We ignore other messages.The incoming messages are processed and a respond is send via the Facebook channel. However, if you want to handle more messages, you can adapt the existing Facebook Connector to handle more messages ([Custom Connectors](https://rasa.com/docs/rasa/user-guide/connectors/custom-connectors/)).

---

<div class="post-metadata">

**Author:** ![im-singh](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/im-singh/32/4277_2.png) [@im-singh](https://forum.rasa.com/u/im-singh)\
**Post date:** [August 29, 2019, 10:52am UTC](https://forum.rasa.com/t/action-server-exception-handling/14815/5 "2019-08-29T10:52:47Z")

</div>

I am talking about response that we give back to Facebook. So tell me I can control it or not. I think it is more related to how internet works like GET and POST. Just tell is there is any way to control responses. If any…

---

<div class="post-metadata">

**Author:** ![erohmensing](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/erohmensing/32/1789_2.png) [@erohmensing](https://forum.rasa.com/u/erohmensing)\
**Post date:** [August 29, 2019, 3:06pm UTC](https://forum.rasa.com/t/action-server-exception-handling/14815/6 "2019-08-29T15:06:29Z")

</div>

Hi @im-singh, can you post some screenshots of what your issue is?

---

<div class="post-metadata">

**Author:** ![sarankarthik](https://avatars.discourse-cdn.com/v4/letter/s/c57346/32.png) [@sarankarthik](https://forum.rasa.com/u/sarankarthik)\
**Post date:** [October 29, 2019, 11:59am UTC](https://forum.rasa.com/t/action-server-exception-handling/14815/7 "2019-10-29T11:59:46Z")

</div>

@Tanja @erohmensing, I want to handle the exceptions for API calls in rasa action server. For example, In the rasa action server, I host a local server for API call. If the server is Not Found, I have to respond the user that the requested server is not found and I want to respond the user to make a valid request. Could you give some information on this?

I have tried to implement this using requests.status\_code and throw a message in the action server. But, I want to send the message as a response while interacting to the user in the rasa server

```
 if r.status_code == 200:
    process_message = "The client request has succeeded"
    logger.info(process_message)

```

for which, The output is

> 127.0.0.1 - - [2019-10-29 12:39:25] “POST /webhook HTTP/1.1” 200 169 0.030977

> 127.0.0.1 - - [2019-10-29 12:39:37] “POST /webhook HTTP/1.1” 200 226 0.001980

> 2019-10-29 12:39:38 INFO root - The client request has succeeded

> {‘Addr’: None, ‘Area’: ‘centre’, ‘Day’: None, ‘Food’: ‘italian’, ‘Name’: None, ‘People’: None, ‘Phone’: None, ‘Post’: None, ‘Price’: None, ‘none’: None}

> 2019-10-29 12:39:38 ERROR rasa\_sdk.executor - Your action’s ‘Action-Search’ run method returned an invalid event. Event will be ignored. Event: ‘None’.

> 2019-10-29 12:39:38 ERROR rasa\_sdk.executor - Your action’s ‘Action-Search’ run method returned an invalid event. Event will be ignored. Event: ‘15’.

---

<div class="post-metadata">

**Author:** ![Lindafr](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/lindafr/32/15978_2.png) [@Lindafr](https://forum.rasa.com/u/Lindafr)\
**Post date:** [November 18, 2021, 11:16am UTC](https://forum.rasa.com/t/action-server-exception-handling/14815/8 "2021-11-18T11:16:08Z")

</div>

Hi!

This is an old post, but does anyone have any updates regarding this?
