Form action doesn't ask for failed slots

I created a form action to collect some personal data say name,phone_no, dob, email. When i enter the phone number (invalid one) i am getting below error

Failed to extract slot phone_no with action action_patient_data and bot restarts the entire conversation.

Actually it should ask for the phone number again, right?

when i type invalid phone number it matching withe other intent say booking_number.

    def validate_phone_no(self,
      value: Text,
      dispatcher: CollectingDispatcher,
      tracker: Tracker,
      domain: Dict[Text,Any],
  ) -> Dict[Text,Any]:
      phone_pattern = r'(\b05\d{8}\b)'
      if re.match(phone_pattern,value):
          return {"phone_no":value}
          dispatcher.utter_message("Sorry!!!,Invalid phone number.")

def slot_mappings(self):
    return {
    # "patient_name":self.from_text(intent="PERSON"),

   ## intent:phone_no
  - [0512345678](phone_no)
  - [0512345679](phone_no)
  - [0523456789](phone_no)
  - [0534567890](phone_no)
  - [0545678901](phone_no)
  - [0512345678](phone_no)

  ## regex: phone_no
 - \b05\d{8}\b

How can i resolve this?

Without seeing your full action code I think it may be hard to say, do you have a validation function as well when these slots are filled? Does this only happen on invalid phone numbers? What does your validation function look like sort of like we have in our docs, Forms

Provide some more information and maybe a sample dialogue.

You could improve your regex, for example it wont work in situation when the user says: “My phone number is 0598765432 man”. So rather use


which covers both cases.

Yes i added validation function(included in my question).

I am trying to fill the phone_no slot using "phone_no":self.from_text(intent="phone_no"), if change this to "phone_no":self.from_text(intent=None) it works fine. ie, it fille the phone_no slot with user input and execute the validate_ function.

Edit: Now i have the same issue with slot email. Current slot mapping is "email":self.from_text(intent="email") and if i modify this to "email":self.from_text(intent=None) and a validate_ function, it will work fine. So then what is the use of other functions in Custom slot Mapping.

And what is the use of regex in because i already defined a regex and i need to define avalidate funciton to check the same regex!!! Please suggest any solution…

You’re mixing up intents and entities. A phone number is an entity, that may appear in other contexts as well. Limiting yourself to an intent ‘phone_no’ is definitely bad practice.

The self.from_text mapping, should be used as a fallback, whenever your NLU component is not able to recognize entitites with high confidence. However, phone numbers and email addresses should never be a problem. Use self.from_entity mapping instead.

You could also think about using the duckling entity extractor. It does a good job on extracting such entities.

Entity Extraction

The regex in helps the bot to correctly identitfy an entity, it is not a requirement, that has to be fullfilled.