Hello, I’m testing Rasa X and came across an odd error. When a generated story (from interactive mode) sets a slot with a value that contains the character ‘#’, Rasa X fails to start. The error message is:
$ rasa x
Starting Rasa X in local mode... 🚀
Traceback (most recent call last):
File "/home/local/user/.local/share/virtualenvs/test-rasax-9Mm1a-qJ/lib/python3.6/site-packages/rasa/core/training/dsl.py", line 234, in _parameters_from_json_string
parsed_slots = json.loads(s)
File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 355, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Unterminated string starting at: line 1 column 13 (char 12)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/local/user/.local/share/virtualenvs/test-rasax-9Mm1a-qJ/lib/python3.6/site-packages/rasa/core/training/dsl.py", line 293, in process_lines
event_name, parameters = self._parse_event_line(line[1:])
File "/home/local/user/.local/share/virtualenvs/test-rasax-9Mm1a-qJ/lib/python3.6/site-packages/rasa/core/training/dsl.py", line 261, in _parse_event_line
parameters = StoryFileReader._parameters_from_json_string(slots_str, line)
File "/home/local/user/.local/share/virtualenvs/test-rasax-9Mm1a-qJ/lib/python3.6/site-packages/rasa/core/training/dsl.py", line 249, in _parameters_from_json_string
"object. Error: {}".format(line, e)
ValueError: Invalid to parse arguments in line ' slot{"example": "testing'. Failed to decode parametersas a json object. Make sure the eventname is followed by a proper json object. Error: Unterminated string starting at: line 1 column 13 (char 12)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/local/user/.local/share/virtualenvs/test-rasax-9Mm1a-qJ/lib/python3.6/site-packages/rasax/community/services/story_service.py", line 53, in get_story_steps
return await reader.process_lines(lines)
File "/home/local/user/.local/share/virtualenvs/test-rasax-9Mm1a-qJ/lib/python3.6/site-packages/rasa/core/training/dsl.py", line 313, in process_lines
raise ValueError(msg)
ValueError: Error in line 2: Invalid to parse arguments in line ' slot{"example": "testing'. Failed to decode parametersas a json object. Make sure the eventname is followed by a proper json object. Error: Unterminated string starting at: line 1 column 13 (char 12)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/local/user/.local/share/virtualenvs/test-rasax-9Mm1a-qJ/lib/python3.6/site-packages/rasa/cli/x.py", line 322, in run_locally
local.main(args, project_path, args.data, token=rasa_x_token)
File "/home/local/user/.local/share/virtualenvs/test-rasax-9Mm1a-qJ/lib/python3.6/site-packages/rasax/community/local.py", line 190, in main
project_path, data_path, session, args.port
File "/home/local/user/.local/share/virtualenvs/test-rasax-9Mm1a-qJ/lib/python3.6/site-packages/rasax/community/local.py", line 157, in _initialize_with_local_data
story_files, story_service, COMMUNITY_USERNAME, COMMUNITY_TEAM_NAME
File "uvloop/loop.pyx", line 1451, in uvloop.loop.Loop.run_until_complete
File "/home/local/user/.local/share/virtualenvs/test-rasax-9Mm1a-qJ/lib/python3.6/site-packages/rasax/community/initialise.py", line 109, in inject_stories
story_files, team, username
File "/home/local/user/.local/share/virtualenvs/test-rasax-9Mm1a-qJ/lib/python3.6/site-packages/rasax/community/services/story_service.py", line 193, in save_stories_from_files
add_story_items_to_domain=False,
File "/home/local/user/.local/share/virtualenvs/test-rasax-9Mm1a-qJ/lib/python3.6/site-packages/rasax/community/services/story_service.py", line 106, in save_stories
steps = await self.get_story_steps(story)
File "/home/local/user/.local/share/virtualenvs/test-rasax-9Mm1a-qJ/lib/python3.6/site-packages/rasax/community/services/story_service.py", line 57, in get_story_steps
"'{}'\nError: {}".format(story_string, e)
rasa.core.exceptions.StoryParseError: Invalid story format. Failed to parse '##chars"}
- slot{"example": "testing'
Error: Error in line 2: Invalid to parse arguments in line ' slot{"example": "testing'. Failed to decode parametersas a json object. Make sure the eventname is followed by a proper json object. Error: Unterminated string starting at: line 1 column 13 (char 12)
Sorry, something went wrong (see error above). Make sure to start Rasa X with valid data and valid domain and config files. Please, also check any warnings that popped up.
If you need help fixing the issue visit our forum: http://forum.rasa.com/.
I’ve just created this project with rasa init, added an example slot, and set it using interactive training. rasa train completes without problems, and the story can be triggered in rasa shell, only rasa x can’t deal with the ‘#’ character in the slot value.
The offending story:
## Generated Story 1484935921393187592
* greet
- utter_greet
* mood_unhappy{"example": "testing#chars"}
- slot{"example": "testing#chars"}
- utter_cheer_up
- utter_did_that_help
* affirm
- utter_goodbye
Is this a bug, or completely unsupported? I’ve triggered this issue originally when trying to provide a URL in another chatbot, which included ‘#’.
I’m using rasa-x 0.19.5 with Python 3.6.8 in Ubuntu 18.04.02.