Getting no registered action found for form action - Rasa Open Source - Rasa Community Forum

Getting no registered action found for form action

post by NikhilBansal21 on Dec 18, 2018

Hi,

I have created a form-action by following steps from the formbot and the form-action tutorial in the docs.

RASA core v-0.12.3

I have a story like this -

Story 1

I have registered my form in forms tag in domain file.

On running my bot I am getting below line as a error

Exception: No registered Action found for name ‘consent_form’.

My form policy code looks like this -

class ConsentForm(FormAction):
    """Example of a custom form action"""

def name(self):
        # type: () -> Text
        """Unique identifier of the form"""

return "consent_form"

@staticmethod
    def required_slots(tracker: Tracker) -> List[Text]:
        """A list of required slots that the form has to fill"""

return ["consent"]

def slot_mappings(self):
        # type: () -> Dict[Text: Union[Dict, List[Dict]]]
        """A dictionary to map required slots to
          - an extracted entity
          - intent: value pairs
          - a whole message
          or a list of them, where a first match will be picked"""

return {
                "consent": [self.from_entity(entity="user_consent"),\
                                    self.from_intent(intent='Affirm',\
                                                     value=True),\
                                    self.from_intent(intent='Deny',\
                                                     value=False)],
                }

@staticmethod
    def is_int(string: Text) -> bool:
        """Check if a string is an integer"""  
        try:
            int(string)
            return True
        except ValueError:
            return False

def validate(self,
                dispatcher: CollectingDispatcher,
                tracker: Tracker,
                domain: Dict[Text, Any]) -> List[Dict]:
        """Validate extracted requested slot
            else reject the execution of the form action"""
        # extract other slots that were not requested
        # but set by corresponding entity
        slot_values = self.extract_other_slots(dispatcher, tracker, domain)

# extract requested slot
        slot_to_fill = tracker.get_slot(REQUESTED_SLOT)
        if slot_to_fill:
            slot_values.update(self.extract_requested_slot(dispatcher,
                                                            tracker, domain))
            if not slot_values:
                # reject form action execution
                # if some slot was requested but nothing was extracted
                # it will allow other policies to predict another action
                raise ActionExecutionRejection(self.name(),
                                                "Failed to validate slot {0} "
                                                "with action {1}"
                                                "".format(slot_to_fill,
                                                            self.name()))

# we'll check when validation failed in order
        # to add appropriate utterances
        for slot, value in slot_values.items():

if slot == 'consent':
                if isinstance(value, str):
                    if 'yes' in value:
                        # convert "out..." to True
                        slot_values[slot] = True
                    elif 'no' in value:
                        # convert "in..." to False
                        slot_values[slot] = False
                    else:
                        dispatcher.utter_template('Please input with yes or no to move ahead',
                                                  tracker)
                        # validation failed, set slot to None
                        slot_values[slot] = None

# validation succeed, set the slots values to the extracted values
        return [SlotSet(slot, value) for slot, value in slot_values.items()]

post by satishavhad on Dec 30, 2018

I am getting the similar issue. Any solution?

post by jorgequinterom on Jan 18, 2019

What about your domain file?. Did you declare the FormAction there?

post by argideritzalpea on Jan 18, 2019

I have the exact same problem.

NotImplementedError: A form must implement required slots that it has to fill
127.0.0.1 - - [2019-01-18 11:57:21] "POST /webhook HTTP/1.1" 500 412 0.010005
2019-01-18 11:57:21 ERROR    rasa_core.actions.action  - Failed to run custom action 'count_episode'. Action server responded with a non 200 status code of 500. Make sure your action server properly runs actions and returns a 200 once the action is executed. Error: 500 Server Error: INTERNAL SERVER ERROR for url: http://localhost:5055/webhook
2019-01-18 11:57:21 ERROR    rasa_core.processor  - Encountered an exception while running action 'count_episode'. Bot will continue, but the actions events are lost. Make sure to fix the exception in your custom code.
2019-01-18 11:57:21 DEBUG    rasa_core.processor  - Failed to execute custom action.
Traceback (most recent call last):
  File "/Users/anaconda3/lib/python3.6/site-packages/rasa_core/actions/action.py", line 339, in run
    response.raise_for_status()
  File "/Users/anaconda3/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status()
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: INTERNAL SERVER ERROR for url: http://localhost:5055/webhook

post by ahson on Jan 31, 2019

Having a similar issue, were you able to find a solution? Would appreciate any insight, thanks!

post by argideritzalpea on Jan 31, 2019

If I remember correctly, you need to restart the action server for the changes to take effect. Mine was running and not restarting because it didn’t shut down properly I think.

post by Sam2 on Apr 16, 2019

Hi everyone !

I had the same issue and just solved it.

You just need to put your action.py file inside an actions folder and then run the action server. Hope it will work for you too !