Issue with Pro CALM installation [Update: Resolved]

Hi, I have crossed check my commands and dependencies multiple times. Inspite of trying various different alternatives it keeps coming back to the same issue.

I still am not able to use or test Rasa Pro CALM properly due to the following error. :face_with_head_bandage:

Could someone please explain or help me resolve this issue.

2024-10-01 18:55:37 INFO     root  - Starting Rasa server on http://0.0.0.0:5005
2024-10-01 18:55:38 INFO     rasa.core.processor  - Loading model models\20241001-185527-heartless-artifact.tar.gz...
2024-10-01 18:55:39 ERROR    rasa.core.agent  - Could not load model due to Error initializing graph component for node flows_provider..
Traceback (most recent call last):
  File "C:\Users\MuhammedMuzzammil\Desktop\RasaDevelopment\venv\lib\site-packages\rasa\engine\graph.py", line 435, in _load_component
    self._component: GraphComponent = constructor(  # type: ignore[no-redef]
  File "C:\Users\MuhammedMuzzammil\Desktop\RasaDevelopment\venv\lib\site-packages\rasa\graph_components\providers\flows_provider.py", line 52, in load
    flows = YAMLFlowsReader.read_from_file(
  File "C:\Users\MuhammedMuzzammil\Desktop\RasaDevelopment\venv\lib\site-packages\rasa\shared\core\flows\yaml_flows_io.py", line 44, in read_from_file
    return cls.read_from_string(
  File "C:\Users\MuhammedMuzzammil\Desktop\RasaDevelopment\venv\lib\site-packages\rasa\shared\core\flows\yaml_flows_io.py", line 221, in read_from_string
    validate_yaml_with_jsonschema(
  File "C:\Users\MuhammedMuzzammil\Desktop\RasaDevelopment\venv\lib\site-packages\rasa\shared\utils\yaml.py", line 854, in validate_yaml_with_jsonschema
    source_data = read_yaml(yaml_file_content, reader_type=["safe", "rt"])
  File "C:\Users\MuhammedMuzzammil\Desktop\RasaDevelopment\venv\lib\site-packages\rasa\shared\utils\yaml.py", line 438, in read_yaml
    .decode("raw_unicode_escape")
UnicodeDecodeError: 'rawunicodeescape' codec can't decode bytes in position 1691-1692: truncated \UXXXXXXXX escape

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\MuhammedMuzzammil\Desktop\RasaDevelopment\venv\lib\site-packages\rasa\core\agent.py", line 258, in load_agent
    agent.load_model(model_path)
  File "C:\Users\MuhammedMuzzammil\Desktop\RasaDevelopment\venv\lib\site-packages\rasa\core\agent.py", line 360, in load_model
    self.processor = MessageProcessor(
  File "C:\Users\MuhammedMuzzammil\Desktop\RasaDevelopment\venv\lib\site-packages\rasa\core\processor.py", line 128, in __init__
    self.model_filename, self.model_metadata, self.graph_runner = self._load_model(
  File "C:\Users\MuhammedMuzzammil\Desktop\RasaDevelopment\venv\lib\site-packages\rasa\core\processor.py", line 166, in _load_model
    metadata, runner = loader.load_predict_graph_runner(
  File "C:\Users\MuhammedMuzzammil\Desktop\RasaDevelopment\venv\lib\site-packages\rasa\engine\loader.py", line 29, in load_predict_graph_runner   
    runner = graph_runner_class.create(
  File "C:\Users\MuhammedMuzzammil\Desktop\RasaDevelopment\venv\lib\site-packages\rasa\engine\runner\dask.py", line 53, in create
    return cls(graph_schema, model_storage, execution_context, hooks)
  File "C:\Users\MuhammedMuzzammil\Desktop\RasaDevelopment\venv\lib\site-packages\rasa\engine\runner\dask.py", line 39, in __init__
    self._instantiated_nodes: Dict[Text, GraphNode] = self._instantiate_nodes(
  File "C:\Users\MuhammedMuzzammil\Desktop\RasaDevelopment\venv\lib\site-packages\rasa\engine\runner\dask.py", line 62, in _instantiate_nodes     
    return {
  File "C:\Users\MuhammedMuzzammil\Desktop\RasaDevelopment\venv\lib\site-packages\rasa\engine\runner\dask.py", line 63, in <dictcomp>
    node_name: GraphNode.from_schema_node(
  File "C:\Users\MuhammedMuzzammil\Desktop\RasaDevelopment\venv\lib\site-packages\rasa\engine\graph.py", line 611, in from_schema_node
    return cls(
  File "C:\Users\MuhammedMuzzammil\Desktop\RasaDevelopment\venv\lib\site-packages\rasa\engine\graph.py", line 422, in __init__
    self._load_component()
  File "C:\Users\MuhammedMuzzammil\Desktop\RasaDevelopment\venv\lib\site-packages\rasa\engine\graph.py", line 448, in _load_component
    raise GraphComponentException(
rasa.engine.exceptions.GraphComponentException: Error initializing graph component for node flows_provider.
2024-10-01 18:55:39 INFO     root  - Rasa server is up and running.
[2024-10-01 18:55:39 +0530] [1584] [INFO] Starting worker [1584]
2024-10-01 18:55:39 INFO     sanic.server  - Starting worker [1584]
[2024-10-01 18:55:40 +0530] [1584] [ERROR] Exception occurred while handling uri: 'http://localhost:5005/flows'
Traceback (most recent call last):
  File "handle_request", line 96, in handle_request
  File "C:\Users\MuhammedMuzzammil\Desktop\RasaDevelopment\venv\lib\site-packages\rasa\server.py", line 267, in decorated
    return await result if isawaitable(result) else result
  File "C:\Users\MuhammedMuzzammil\Desktop\RasaDevelopment\venv\lib\site-packages\rasa\server.py", line 1430, in get_flows
    flows = await processor.get_flows()
AttributeError: 'NoneType' object has no attribute 'get_flows'
2024-10-01 18:55:42 ERROR    rasa.server  - No agent loaded. To continue processing, a model of a trained agent needs to be loaded.
2024-10-01 18:55:42 ERROR    rasa.server  - No agent loaded. To continue processing, a model of a trained agent needs to be loaded.
2024-10-01 18:55:43 ERROR    rasa.server  - No agent loaded. To continue processing, a model of a trained agent needs to be loaded.
2024-10-01 18:55:43 ERROR    rasa.server  - No agent loaded. To continue processing, a model of a trained agent needs to be loaded.
2024-10-01 18:55:44 ERROR    rasa.server  - No agent loaded. To continue processing, a model of a trained agent needs to be loaded.
2024-10-01 18:55:44 ERROR    rasa.server  - No agent loaded. To continue processing, a model of a trained agent needs to be loaded.
2024-10-01 18:55:45 ERROR    rasa.server  - No agent loaded. To continue processing, a model of a trained agent needs to be loaded.
2024-10-01 18:55:45 ERROR    rasa.server  - No agent loaded. To continue processing, a model of a trained agent needs to be loaded.
2024-10-01 18:55:47 ERROR    rasa.server  - No agent loaded. To continue processing, a model of a trained agent needs to be loaded.
2024-10-01 18:55:47 ERROR    rasa.server  - No agent loaded. To continue processing, a model of a trained agent needs to be loaded.
2024-10-01 18:55:48 ERROR    rasa.server  - No agent loaded. To continue processing, a model of a trained agent needs to be loaded.
2024-10-01 18:55:48 ERROR    rasa.server  - No agent loaded. To continue processing, a model of a trained agent needs to be loaded.
2024-10-01 18:55:49 ERROR    rasa.server  - No agent loaded. To continue processing, a model of a trained agent needs to be loaded.
2024-10-01 18:55:49 ERROR    rasa.server  - No agent loaded. To continue processing, a model of a trained agent needs to be loaded.
[2024-10-01 18:55:49 +0530] [1584] [INFO] Stopping worker [1584]
2024-10-01 18:55:49 INFO     sanic.server  - Stopping worker [1584]

SOLUTION:

The issue seems to be occuring while trying to handle emojies, therefore the unicode characters have caused some issue. To resolve that, have added an addition line where if the emojie is not recognised, replace it with a unknown symbol (like <?>)

    if _is_ascii(content):
        # Required to make sure emojis are correctly parsed
        content = (
            content.encode("utf-8", errors="replace") #CHANGE WAS MADE HERE
            .decode("utf-8") #CHANGE WAS MADE HERE
            .encode("utf-16", "surrogatepass")
            .decode("utf-16")
        )

Code path: lib\site-packages\rasa\shared\utils\yaml.py", line 438, in read_yaml

NOTE: This method had worked for me and it was able to run the bot smoothly, however if there are any alternatives to this, please do correct me :slight_smile:

New Update:

This issue has been resolved in the Rasa Pro version 3.10.6. So you don’t have to follow what i did, just update your rasa :slight_smile:

Rasa Pro developers coming to our rescue like-

1 Like

In the latest version rasa-pro==3.10.11, we get the same error, from the same piece of code. However this time the error is caused by filenames in data\flows that start with β€œu”.
Turns out the code tries to process whole content - together with filename as string. In the process the filename, say u_my_flow.yml ends up as data\flows\u_my_flow.yml in the string. Notice that \u in the string, that patch of code thinks this is invalid unicode escape, thus raises error. ultimately leading to model not being loaded.
Note that this bug is not present in earlier versions.
Currently, workaround is to not have data\flows files starting with β€œu” :slight_smile: