Encountered an exception while running action 'action_search_restaurant'. Bot will continue, but the actions events are lost. Please check the logs of your action server for more information

getting this error,

logs in “rasa run actions”:

Exception occurred while handling uri: ‘http://localhost:5055/webhook’ Traceback (most recent call last): File “c:\python3.6\lib\site-packages\sanic\app.py”, line 942, in handle_request response = await response File “c:\python3.6\lib\site-packages\rasa_sdk\endpoint.py”, line 86, in webhook result = await executor.run(action_call) File “c:\python3.6\lib\site-packages\rasa_sdk\executor.py”, line 280, in run events = action(dispatcher, tracker, domain) File “C:\Users\msi1\Desktop\projects\rasa\rasaenv\actions.py”, line 60, in run dispatcher.utter_message(text=message) UnboundLocalError: local variable ‘message’ referenced before assignment

error logs at " rasa shell" Your input -> show me indian res 2020-06-08 00:29:00 ERROR rasa.core.processor - Encountered an exception while running action ‘action_search_restaurant’. Bot will continue, but the actions events are lost. Please check the logs of your action server for more information. Your input ->

i am attaching rasa files please check.

nlu.md (900 Bytes) stories.md (541 Bytes) actions.py (1.8 KB) domain.yml (872 Bytes) endpoints.yml (1.5 KB)

i have even tried for solution for following thread too, but no success:

thanks in advance

Hi @omkarcpatil

It looks like message variable is not declared globally in your actions.py and its been referenced into dispatcher,

I looked into your files.You have forgotten to declare the

entities:
- hotel

in your domain.yml

Try declaring your entities and it will work.

Hello @MuraliChandran14,

thanks for help, but changing this in domain.yml didnt help. the error is same. Your input -> show me indian res 2020-06-08 21:57:56 ERROR rasa.core.processor - Encountered an exception while running action ‘action_search_restaurant’. Bot will continue, but the actions events are lost. Please check the logs of your action server for more information. domain.yml (893 Bytes)

i have attached my domain.yml file rest all files are the same. i searched a few places it says, mostly issue is in actions.py file

am i missing someting now?

Hi @omkarcpatil,

image

remove the space and rewrite your nlu.md

## intent: search_restaurant
- show me [indian](hotel) res
- show me [chinese](hotel) res
- show me [thai](hotel) res
- show me [italian](hotel) res

because of the space the entities are not extracted properly.

1 Like

Thank you very much @MuraliChandran14,

that solved my issue but could you tell me why are spaces giving issue to entity extraction?

@omkarcpatil

This is my take on why space is a issue to entity extraction.

Rasa uses DIET architecture. In a Pipeline everything is executed step by step.

If It sees a WhitespaceTokenizer results will be coming out as text + tokens. The text and tokens are feed into separate blocks for training.

Entity is a label you are assigning to the particular vocabulary or word in your nlu.md

In DIET architecture the entities are extracted and pushed into CRF.

In your case when you provided space next to [indian]

show me [indian] (hotel) res.

The architecture does not quietly understand what the entity is. That’s why when you trained the model. The entity (hotel) which doesn’t have a value [indian]and was never recognized on the actions.py as well as nlu traning.

@koaning any comments on it.

2 Likes

One comment about DIET. Our standard method for extracting entities is indeed the DIETClassifier but you are also able to select other entities detectors. These can be based on regexes, tools like Duckling, spaCy or a custom tool that you’ve written yourself.

As far as the issue with the “spaces”. This is indeed a tokenizer related issue. This is less of a machine learning thing and more of a “this is the syntax of declaring an entity”-thing. The entities need to be extracted and encoded in a way that a entity detector can recognize them as such. If there is a space in between then the tokenizer will pick them up as two seperate words. This is not related to DIET rather related to how we map an entity to a token.

3 Likes

even i got the same error when i want to save my slot values to excel. Please help me to solve this error

domain.yml (1.6 KB) nlu.yml (1.7 KB) stories.yml (736 Bytes) actions.py (1.6 KB)

this is in rasa run actions error

After having little conversation with the bot ,after 3-4 actions it shows the error like this.

Bot loaded. Type a message and press enter (use '/stop' to exit): 
Your input ->  Hi                                                                                                                                                
Hey! How are you?
Your input ->  Tell me the weather forcast                                                                                                                       
Which city do you want to check for?.
Your input ->  Egypt                                                                                                                                             
The temperature is 21.
Your input ->  Hi                                                                                                                                                
2021-08-12 16:42:41 ERROR    asyncio  - Exception in callback _ProactorBasePipeTransport._call_connection_lost(None)
handle: <Handle _ProactorBasePipeTransport._call_connection_lost(None)>
Traceback (most recent call last):
  File "D:\Anaconda3\envs\bot\lib\asyncio\events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "D:\Anaconda3\envs\bot\lib\asyncio\proactor_events.py", line 162, in _call_connection_lost
    self._sock.shutdown(socket.SHUT_RDWR)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
Hey! How are you?
Your input ->  weather                                                                                                                                           
Which city do you want to check for?.
Your input ->  Cannada                                                                                                                                           
2021-08-12 16:43:09 ERROR    rasa.core.processor  - Encountered an exception while running action 'action_weather_api'.Bot will continue, but the actions events 
are lost. Please check the logs of your action server for more information.
Traceback (most recent call last):
  File "D:\Anaconda3\envs\bot\lib\site-packages\rasa\core\actions\action.py", line 685, in run
    response = await self.action_endpoint.request(
  File "D:\Anaconda3\envs\bot\lib\site-packages\rasa\utils\endpoints.py", line 172, in request
    raise ClientResponseError(
rasa.utils.endpoints.ClientResponseError: 500, Internal Server Error, body='b'<!DOCTYPE html><html lang=en><meta charset=UTF-8><title>\xe2\x9a\xa0\xef\xb8\x8f 500 \xe2\x80\x94 Internal Server Error</title>\n<style>\n        html { font-family: sans-serif }\n        h2 { color: #888; }\n        .tb-wrapper p { margin: 0 }\n        .frame-border { margin: 1rem }\n        .frame-line > * { padding: 0.3rem 0.6rem }\n        .frame-line { margin-bottom: 0.3rem }\n        .frame-code 
{ font-size: 16px; padding-left: 4ch }\n        .tb-wrapper { border: 1px solid #eee }\n        .tb-header { background: #eee; padding: 0.3rem; font-weight: bold }\n        .frame-descriptor { background: #e2eafb; font-size: 14px }\n    </style>\n<h1>\xe2\x9a\xa0\xef\xb8\x8f 500 \xe2\x80\x94 Internal Server Error</h1><p>The server encountered an internal error and cannot complete your request.\n''

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\Anaconda3\envs\bot\lib\site-packages\rasa\core\processor.py", line 772, in _run_action
    events = await action.run(
  File "D:\Anaconda3\envs\bot\lib\site-packages\rasa\core\actions\action.py", line 709, in run
    raise RasaException("Failed to execute custom action.") from e
rasa.shared.exceptions.RasaException: Failed to execute custom action.
Your input ->  Hi                                                                                                                                                
2021-08-12 17:01:01 ERROR    asyncio  - Exception in callback _ProactorBasePipeTransport._call_connection_lost(None)
handle: <Handle _ProactorBasePipeTransport._call_connection_lost(None)>
Traceback (most recent call last):
  File "D:\Anaconda3\envs\bot\lib\asyncio\events.py", line 81, in _run
    self._context.run(self._callback, *self._args)
  File "D:\Anaconda3\envs\bot\lib\asyncio\proactor_events.py", line 162, in _call_connection_lost
    self._sock.shutdown(socket.SHUT_RDWR)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
Hey! How are you?
Your input ->  Hi                                                                                                                                                
Hey! How are you?
Your input ->  Weather                                                                                                                                           
Which city do you want to check for?.
Your input ->  Dubai                                                                                                                                             
The temperature is 38.
Your input ->  Hi                                                                                                                                                
Hey! How are you?
Your input ->  Weather                                                                                                                                           
Which city do you want to check for?.
Your input ->  America                                                                                                                                           
The temperature is 28.
Your input ->  Hi                                                                                                                                                
Hey! How are you?
Your input ->  Weather                                                                                                                                           
Which city do you want to check for?.
Your input ->  Cannada                                                                                                                                           
2021-08-12 17:03:02 ERROR    rasa.core.processor  - Encountered an exception while running action 'action_weather_api'.Bot will continue, but the actions events 
are lost. Please check the logs of your action server for more information.
Traceback (most recent call last):
  File "D:\Anaconda3\envs\bot\lib\site-packages\rasa\core\actions\action.py", line 685, in run
    response = await self.action_endpoint.request(
  File "D:\Anaconda3\envs\bot\lib\site-packages\rasa\utils\endpoints.py", line 172, in request
    raise ClientResponseError(
rasa.utils.endpoints.ClientResponseError: 500, Internal Server Error, body='b'<!DOCTYPE html><html lang=en><meta charset=UTF-8><title>\xe2\x9a\xa0\xef\xb8\x8f 500 \xe2\x80\x94 Internal Server Error</title>\n<style>\n        html { font-family: sans-serif }\n        h2 { color: #888; }\n        .tb-wrapper p { margin: 0 }\n        .frame-border { margin: 1rem }\n        .frame-line > * { padding: 0.3rem 0.6rem }\n        .frame-line { margin-bottom: 0.3rem }\n        .frame-code 
{ font-size: 16px; padding-left: 4ch }\n        .tb-wrapper { border: 1px solid #eee }\n        .tb-header { background: #eee; padding: 0.3rem; font-weight: bold }\n        .frame-descriptor { background: #e2eafb; font-size: 14px }\n    </style>\n<h1>\xe2\x9a\xa0\xef\xb8\x8f 500 \xe2\x80\x94 Internal Server Error</h1><p>The server encountered an internal error and cannot complete your request.\n''

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "D:\Anaconda3\envs\bot\lib\site-packages\rasa\core\processor.py", line 772, in _run_action
    events = await action.run(
  File "D:\Anaconda3\envs\bot\lib\site-packages\rasa\core\actions\action.py", line 709, in run
    raise RasaException("Failed to execute custom action.") from e
rasa.shared.exceptions.RasaException: Failed to execute custom action.