No registered action found for name 'action_sort_user'

Hello everyone, Recently we have started using RASA in our class for a project, therefore I am very new to RASA. I am trying to build a bot and I created a custom action called “action_sort_user” that randomly sorts the user in one of the four hogwarts houses. However, I am getting the following error:

Traceback (most recent call last):
  File "C:\Users\mahaa\Anaconda3\envs\masters\lib\site-packages\rasa\core\actions\action.py", line 742, in run
    response: Any = await self.action_endpoint.request(
  File "C:\Users\mahaa\Anaconda3\envs\masters\lib\site-packages\rasa\utils\endpoints.py", line 173, in request
    raise ClientResponseError(
rasa.utils.endpoints.ClientResponseError: 404, Not Found, body='b'{"error":"No registered action found for name \'action_sort_user\'.","action_name":"action_sort_user"}''

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

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

when running the action server with the command:

rasa run actions -vv 

I see the following log:

2022-04-18 15:15:00 INFO     rasa_sdk.endpoint  - Starting action endpoint server...
2022-04-18 15:15:00 INFO     rasa_sdk.endpoint  - Action endpoint is up and running on http://0.0.0.0:5055
2022-04-18 15:15:00 DEBUG    rasa_sdk.utils  - Using the default number of Sanic workers (1).
2022-04-18 15:16:50 DEBUG    rasa_sdk.executor  - Received request to run 'action_sort_user'
2022-04-18 15:16:50 ERROR    rasa_sdk.endpoint  - No registered action found for name 'action_sort_user'.

I have read the documentation and followed the instructions accordingly. My actions.py contains the following code:

from typing import Text, Dict, Any, List
from rasa_sdk import Action, Tracker
from rasa_sdk.events import SlotSet

from rasa_sdk.executor import CollectingDispatcher

import pandas as pd 
import random 
import csv

class ActionSortUser(Action):
    houses = [("gryffindor", "where dwell the brave, courageous and chivalrous at heart"), 
               ("ravenclaw", "who are know for their intelligence, wisdom and wit"), 
               ("hufflepuff", "who value hardwork, dedication, patience and loyality"),
               ("slytherin", "where roam the cunning, ambitious, resourceful people")]

    def name(self) -> Text:
        return "action_sort_user"

    def run(self, 
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

        # select a random house from the houses 
        house = random.choice(self.houses)

        # print the house to the dispatcher 
        dispatcher.utter_message(text=f"I will sort you into {house[0]}, {house[1]}")

        return []

      

I have specified the action in the domain.yml file:

actions:
  - action_sort_user

In the stories.yml file the relevant code is:

- story: sort me to a house 1
  steps:
  - intent: greet 
  - action: utter_greet 
  - intent: sort 
  - action: action_sort_user 
  - action: utter_did_that_help 
  - or:
    - intent: affirm
    - intent: thanks 
  - action: utter_happy

I have also uncommented the following line in the endpoints.yml file:

action_endpoint:
 url: "http://localhost:5055/webhook"

I have been trying to figure this out for a while with no avail. I would really appreciate if anyone could point me to the right direction, my deadline is approaching soon :sweat_smile:

Hi! Your configuration is right but i think we has some mistake in action.py

Can you try to put houses in run function and try again?

from typing import Text, Dict, Any, List
from rasa_sdk import Action, Tracker
from rasa_sdk.events import SlotSet

from rasa_sdk.executor import CollectingDispatcher

import pandas as pd 
import random 
import csv

class ActionSortUser(Action):

    def name(self) -> Text:
        return "action_sort_user"

    def run(self, 
            dispatcher: CollectingDispatcher,
            tracker: Tracker,
            domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

        houses = [("gryffindor", "where dwell the brave, courageous and chivalrous at heart"), 
            ("ravenclaw", "who are know for their intelligence, wisdom and wit"), 
            ("hufflepuff", "who value hardwork, dedication, patience and loyality"),
            ("slytherin", "where roam the cunning, ambitious, resourceful people")]

        # select a random house from the houses 
        house = random.choice(self.houses)

        # print the house to the dispatcher 
        dispatcher.utter_message(text=f"I will sort you into {house[0]}, {house[1]}")

        return []

The action name needs to show when you enable the action server

Hi! thank you for the suggestion. I made the change but still getting the same error.

Hum… i will test in my local and return soon :blush:

sure thank you :slightly_smiling_face::

Its working fine here rasa 2.8.27

I like to use kill (macos/linux) with rasa run

kill -9 $(lsof -t -i:5055) & rasa run actions

i’m sharing my project folder

test_actions.zip (10.5 KB)

Ok so the version you sent me work on machine as well. But I really don’t understand what I was doing wrong that was causing the erro :sweat_smile: btw my rasa version is 3.1.0.

I don’t know why its happen too I can try it on rasa 3.1.0 later

It’s weird because it looks like it’s not catching your updated version of action.py

Can I send you my folder so we can see if it is working for you ?

Yes! @maha_agro

If possible, give me your rasa --version too :blush:

Thank you !

Rasa Version      :         3.1.0
Minimum Compatible Version: 3.0.0
Rasa SDK Version  :         3.1.1
Rasa X Version    :         None
Python Version    :         3.9.12
Operating System  :         Windows-10-10.0.22000-SP0
Python Path       :         C:\Users\mahaa\Anaconda3\envs\masters\python.exe

Apologies it appears that my folder is too big. I have uploaded it on the following repository:

Everything working fine here

The only thing different is my python version (3.8.9)

But, can you check your action.py? Are you editing the correct file? :joy:

Because this file is empty in your repository. Look: your action.py

I used action from your post

Rasa Version      :         3.1.0
Minimum Compatible Version: 3.0.0
Rasa SDK Version  :         3.1.1
Rasa X Version    :         None
Python Version    :         3.8.9

My steps:

  1. pip install spacy
  2. pip install transformers
  3. python -m spacy download en_core_web_md
  4. pip install pandas

Hey I figured it out :sweat_smile: honestly it was the dumbest mistake ever. My actions.py wasn’t in the right directory. Thank you for bearing with me even though I made an extremely dumb mistake.

:joy: :joy: :joy:

No worries. This happen with the bests :stuck_out_tongue:

Remember to close this thread :smiley:

yeah sure sorry I forgot to do it.