Name Error when doing rasa_core training with custom actions_action.py

rasa_nlu version: 0.13.3 rasa_core version: 0.13.0a1

I got the following error when I do rasa_core training with custom actions_action.py file.

C:\Users\thinkcol\Anaconda3\lib\site-packages\pykwalify\core.py:99: UnsafeLoaderWarning:
The default 'Loader' for 'load(stream)' without further arguments can be unsafe.
Use 'load(stream, Loader=ruamel.yaml.Loader)' explicitly if that is OK.
Alternatively include the following in your code:

  import warnings
  warnings.simplefilter('ignore', ruamel.yaml.error.UnsafeLoaderWarning)

In most other cases you should consider using 'safe_load(stream)'
  data = yaml.load(stream)
Processed Story Blocks: 100%|██████████████████████████████████████████| 19/19 [00:00<00:00, 1216.32it/s, # trackers=1]
Processed Story Blocks: 100%|██████████████████████████████████████████| 19/19 [00:00<00:00, 243.26it/s, # trackers=13]
Processed Story Blocks: 100%|██████████████████████████████████████████| 19/19 [00:00<00:00, 135.14it/s, # trackers=18]
Processed Story Blocks: 100%|███████████████████████████████████████████| 19/19 [00:00<00:00, 92.77it/s, # trackers=27]
Traceback (most recent call last):
  File "c:\users\thinkcol\documents\github\rasa_core\rasa_core\domain.py", line 309, in index_for_action
    return self.action_names.index(action_name)
ValueError: '' is not in list

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\thinkcol\Anaconda3\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "C:\Users\thinkcol\Anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "c:\users\thinkcol\documents\github\rasa_core\rasa_core\train.py", line 351, in <module>
    additional_args)
  File "c:\users\thinkcol\documents\github\rasa_core\rasa_core\train.py", line 266, in do_default_training
    kwargs=additional_arguments)
  File "c:\users\thinkcol\documents\github\rasa_core\rasa_core\train.py", line 190, in train_dialogue_model
    agent.train(training_data, **kwargs)
  File "c:\users\thinkcol\documents\github\rasa_core\rasa_core\agent.py", line 511, in train
    **kwargs)
  File "c:\users\thinkcol\documents\github\rasa_core\rasa_core\policies\ensemble.py", line 60, in train
    policy.train(training_trackers, domain, **kwargs)
  File "c:\users\thinkcol\documents\github\rasa_core\rasa_core\policies\keras_policy.py", line 140, in train
    **kwargs)
  File "c:\users\thinkcol\documents\github\rasa_core\rasa_core\policies\policy.py", line 63, in featurize_for_training
    domain)
  File "c:\users\thinkcol\documents\github\rasa_core\rasa_core\featurizers.py", line 380, in featurize_trackers
    y = self._featurize_labels(trackers_as_actions, domain)
  File "c:\users\thinkcol\documents\github\rasa_core\rasa_core\featurizers.py", line 349, in _featurize_labels
    for action in tracker_actions]
  File "c:\users\thinkcol\documents\github\rasa_core\rasa_core\featurizers.py", line 349, in <listcomp>
    for action in tracker_actions]
  File "c:\users\thinkcol\documents\github\rasa_core\rasa_core\featurizers.py", line 47, in action_as_one_hot
    y[domain.index_for_action(action)] = 1
  File "c:\users\thinkcol\documents\github\rasa_core\rasa_core\domain.py", line 311, in index_for_action
    self._raise_action_not_found_exception(action_name)
  File "c:\users\thinkcol\documents\github\rasa_core\rasa_core\domain.py", line 320, in _raise_action_not_found_exception
    "".format(action_name, action_names))
NameError: Can not access action '', as that name is not a registered action for this domain. Available actions are:
         - action_listen
         - action_restart
         - action_default_fallback
         - action_deactivate_form
         - utter_bmgs
         - utter_greet
         - utter_solution_hkisland
         - utter_bmgs_single
         - utter_bmgs_owner
         - utter_solution_nt
         - utter_transfer
         - utter_goodbye
         - utter_unqualified
         - utter_congrats_form
         - utter_wealth_low
         - utter_defective_windows_solution
         - utter_wealth_high
         - utter_unclear
         - utter_bmgs_both
         - utter_water_leakage
         - utter_solution_kowloon
         - utter_thanks
         - action_search_form
         - action_congrats_form

But I found that all the above names are included in my domain_action.yml file. Does anyone encounter the same problem?

The error is saying that the action ’ ’ (empty action) is not in your list of action. So of course all the names in your domain, because the error is listing your actions. Idk the reason of the error tho, rasa_core 13.0 is maybe not stable yet ? Did you try with the 0.12.2 ?

Thank you very much @huberrom. Let me try using 0.12.2.

I found the solution and it was solved. It was due to the incorrect structure of domain format.

can you please elaborate how you solved this issue?

Hi @shena, I think what @cctong-castiel did was correct the indentation of the domain file so that it follows the exact rasa format.

1 Like