Video attachment error?

Hi there,

I have been previously embedding videos in a Rasa system as follows:

dispatcher.utter_message( attachment={ “type”: “video”, “payload”: { “title”: “Here is a video”, “src”: “” } } )

However, this has started causing a strange error, the output is as follows:

2021-11-24 11:18:03 ERROR asyncio - Task exception was never retrieved future: <Task finished coro=<configure_app..run_cmdline_io() done, defined at c:filepath\env\lib\site-packages\rasa\core\> exception=TypeError(‘can only concatenate str (not “dict”) to str’)> Traceback (most recent call last): File “c:filepath\env\lib\site-packages\rasa\core\”, line 134, in run_cmdline_io sender_id=conversation_id, File “c:filepath\env\lib\site-packages\rasa\core\channels\”, line 152, in record_messages button_question = print_bot_output(response) File “c:filepath\env\lib\site-packages\rasa\core\channels\”, line 37, in print_bot_output cli_utils.print_color("Attachment: " + message.get(“attachment”), color=color) TypeError: can only concatenate str (not “dict”) to str Transport closed @ (‘’, 54758) and exception experienced during error handling

This error doesn’t happen when I replace the attachment message with a text output. It’s definitely the attachment format that throws this error.

Output HAS to come from as there is some additional logic to do with the particular link output to the user.

System is using the following versions: rasa==1.10.2 rasa-core==0.8.2 rasa-nlu==0.13.3 rasa-sdk==1.10.3 rasa-x==0.32.2

Any ideas?

@ronankff Try this

  - text: "Check this video"
    attachment: { "type":"video", "payload":{ "src": "" } }


msg = { "type": "video", "payload": { "title": "Link name", "src": "" } }

dispatcher.utter_message(text="Check this video",attachment=msg)

Can you update the rasa version to at least 2.8.1 and 2.8.1 for Rasa and Rasa-Idk ? If version is not a issue?

PS: You need to copy the embed link only.

Thanks for the response nik. Unfortunately it’s the same error.

And no, we cannot update to 2.8.1+.

@ronankff what is your front end?

I’m currently running through Rasa shell

@ronankff can you share me the Class/ code for this section only, where you mention the dispatcher?

@ronankff Ronan, check my second code please attachment=msg and JSON data should be above not inside dispatcher.utter_message that why I guess dict issue is coming.

I have placed a print method into the run method and that block of code does execute. It fails when dispatcher tries to utter the message. Replacing it with your solution was the same problem.

string only…

Apologies but I don’t understand. Where am I using a dictionary where there should be a string?

@ronankff Did you do this? :thinking::thinking:

class ActionIntoShowVideo(Action):

     def name(self) -> Text:
         return "action_intro_show_video"

     def run(self, dispatcher: CollectingDispatcher,
             tracker: Tracker,
             domain: Dict[Text, Any]) -> List[Dict[Text, Any]]:

         msg = { "type": "video", "payload": { "title": "Link name", "src": "" } }

         dispatcher.utter_message(text="Check this video",attachment=msg)
         return []


@ronankff strange man!