Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gracefully handle when intents in stories.yml or rules.yml have no value #8587

Closed
sentry-io bot opened this issue May 2, 2021 · 1 comment · Fixed by #8648
Closed

Gracefully handle when intents in stories.yml or rules.yml have no value #8587

sentry-io bot opened this issue May 2, 2021 · 1 comment · Fixed by #8648
Assignees
Labels
area:rasa-oss 🎡 Anything related to the open source Rasa framework area:rasa-oss/training-data Issues focused around Rasa training data (stories, NLU, domain, etc.) effort:atom-squad/1 Label which is used by the Rasa Atom squad to do internal estimation of task sizes. tool:sentry type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@sentry-io
Copy link

sentry-io bot commented May 2, 2021

Sentry Issue: RASA-OPEN-SOURCE-9YN

Stack Trace

AttributeError: 'NoneType' object has no attribute 'strip'
(22 additional frame(s) were not displayed)
...
  File "rasa/shared/core/training_data/story_reader/yaml_story_reader.py", line 258, in _parse_plain_item
    self._parse_step(step)
  File "rasa/shared/core/training_data/story_reader/yaml_story_reader.py", line 279, in _parse_step
    self._parse_user_utterance(step)
  File "rasa/shared/core/training_data/story_reader/yaml_story_reader.py", line 314, in _parse_user_utterance
    utterance = self._parse_raw_user_utterance(step)
  File "rasa/shared/core/training_data/story_reader/yaml_story_reader.py", line 414, in _parse_raw_user_utterance
    intent_name, full_retrieval_intent = self._user_intent_from_step(step)
  File "rasa/shared/core/training_data/story_reader/yaml_story_reader.py", line 373, in _user_intent_from_step
    user_intent = step.get(KEY_USER_INTENT, "").strip()

Further Information

This error can be reproduced if we have an intent with no value :

in rules.yml like shown below

version: "2.0"
rules:
  - rule: Greet user
    steps:
      - intent:
      - action: utter_greet

or in stories.yml like shown below

version: "2.0"
stories:
  - story: stop form + continue
    steps:
      - intent:
      - action: restaurant_form

** Command that led to error**:

rasa train

Potential Solutions

  • Add a check in the code which checks that step.get(KEY_USER_INTENT, "") has a value and otherwise it raises :
    • an InvalidRule error if the object is a RuleParser
    • an InvalidStory error if the object is a StoryParser

Fun Fact

  • The function _user_intent_from_step has an argument called step and python debugger pdb has a command called step. So if someone wants to debug with pdb while being inside that function and tries to see what the variable step has by giving (Pdb) step tough luck! It will just move on the next statement. Temporarily renaming the argument works though. :)
@Imod7 Imod7 changed the title AttributeError: 'NoneType' object has no attribute 'strip' Gracefully handle when intents in stories.yml or rules.yml have no value May 2, 2021
@Imod7 Imod7 added area:rasa-oss 🎡 Anything related to the open source Rasa framework area:rasa-oss/training-data Issues focused around Rasa training data (stories, NLU, domain, etc.) tool:sentry type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors. labels May 2, 2021
@joejuzl joejuzl added the effort:atom-squad/1 Label which is used by the Rasa Atom squad to do internal estimation of task sizes. label May 7, 2021
@ancalita ancalita self-assigned this May 10, 2021
@ancalita ancalita linked a pull request May 10, 2021 that will close this issue
4 tasks
@ancalita
Copy link
Member

PR merged to 2.6.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:rasa-oss 🎡 Anything related to the open source Rasa framework area:rasa-oss/training-data Issues focused around Rasa training data (stories, NLU, domain, etc.) effort:atom-squad/1 Label which is used by the Rasa Atom squad to do internal estimation of task sizes. tool:sentry type:bug 🐛 Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants