Failed to run custom actions

Hi there, I have a problem. I am running my interactive training using these 2 commands: rasa run actions and rasa interactive

But when it wants to do an action from the actions.py file it gives this error:

Encountered an exception while running action ‘action_time’. Bot will continue, but the actions events are lost. Please check the logs of your action server for more information.

Here is my actions.py:

from rasa_sdk import Action
from rasa_sdk.events import SlotSet
from datetime import datetime

class ActionTime(Action):
    def name(self):
        return 'action_time'
    
    def run(self, dispatcher, tracker, domain):
        
	current_time = datetime.now().strftime('%H:%M')
	response = """The time is {}.""".format(current_time)
        
        dispatcher.utter_message(response)

And here is my domain.yml:

%YAML 1.1
---
actions:
- action_time
- utter_goodbye
- utter_greet
- utter_noproblem
entities:
- location
intents:
- goodbye
- greet
- inform_time
- thank
slots:
  location:
    type: text
templates:
  utter_goodbye:
  - text: Talk to you later.
  - text: Bye bye!
  - text: Talk to you soon
  utter_greet:
  - text: Hello! How can I help?
  - text: Hi there! What can I do for you?
  utter_noproblem:
  - text: No problem!
  - text: Pleasure to help!
  - text: Always a pleasure!
  - text: You are welcome!
  - text: Of course!

What am I doing wrong?

Hello @PanderBoy18,

I think Custom Actions need to return a list of events which you want to execute, in your situation it’s simply an empty list []. So try adding return [] in the function run() to see if it helps. Btw, normally there are gonna be informations about the exception printed on the console, so be sure to check it whenever you encountered an exception.

Still nothing… The error I gave was the only error I see on the screen. Other suggestions?

Did you check the action server console for the log ? I’m pretty sure there would be some information about the exception there (since i’ve also encountered a lot of exception). It’s pretty hard to solve this without the error log.