rasa icon indicating copy to clipboard operation
rasa copied to clipboard

Check model is not `None` before loading metadata from storage

Open sentry-io[bot] opened this issue 3 years ago • 0 comments

Sentry Issue: RASA-OPEN-SOURCE-HXX

ValueError: nothing to open (4 additional frame(s) were not displayed) 
...
File "rasa__main__.py", line 121, in main 
    cmdline_arguments.func(cmdline_arguments) 
File "rasa\cli\shell.py", line 112, in shell
    metadata = LocalModelStorage.metadata_from_archive(model) 
File "rasa\engine\storage\local_model_storage.py", line 75, in metadata_from_archive 
    cls._extract_archive_to_directory(model_archive_path, temporary_directory) 
File "rasa\engine\storage\local_model_storage.py", line 84, in _extract_archive_to_directory 
    with TarSafe.open(model_archive_path, mode="r:gz") as tar:

Definition of Done

  • [ ] in shell.py, check that model is not None before this line, otherwise raise warning or error that model path could not be found
  • [ ] apply the same check in shell_nlu function too before this line

sentry-io[bot] avatar Feb 18 '22 15:02 sentry-io[bot]

Is this issue still valid? I would like to work on it!

bielrossi15 avatar Aug 18 '22 16:08 bielrossi15

We already raise ModelNotFound exception when local model is None (see here) so the output model will never be None when LocalModelStorage.metadata_from_archive(model) is called.

Upon closer inspection of the Sentry error stack trace, it actually seems that the ValueError(nothing to open) is raised in the context manager Tarsafe.open and that happens only when the argument name is not provided, however we do provide this so I believe this error could be caused by custom code rather than a bug in the public codebase.

ancalita avatar Aug 24 '22 15:08 ancalita