# Using dispatcher utter\_template ended with exception

**URL:** https://forum.rasa.com/t/using-dispatcher-utter-template-ended-with-exception/707
**Category:** Rasa Open Source
**Created:** [August 27, 2018, 6:18pm UTC](https://forum.rasa.com/t/using-dispatcher-utter-template-ended-with-exception/707 "2018-08-27T18:18:03Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![leonardoaii71](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/leonardoaii71/32/458_2.png) [@leonardoaii71](https://forum.rasa.com/u/leonardoaii71)
#### Post date: [August 27, 2018, 6:18pm UTC](https://forum.rasa.com/t/using-dispatcher-utter-template-ended-with-exception/707/1 "2018-08-27T18:18:03Z")

</div>

Hello everyone, I’m having an exception while executing dispatcher.utter\_template(“utter\_ack\_eventdate”, tracker) from a custom action. This is what I get:

```auto
  File "/rasa_core/trackers.py", line 305, in update
    raise ValueError("event to log must be an instance "
ValueError: event to log must be an instance of a subclass of Event.

```

This is my utter template in the domain file:

utter\_ack\_eventdate: - text: “The event {event} will be on {date}”

This is my action method:

```
def run(self, dispatcher, tracker, domain):
    match = tracker.get_slot("date")
    matches = tracker.get_slot("matching_events")

    if match:
        dispatcher.utter_template("utter_ack_eventdate", tracker)
 
    elif matches:
        suggestions = [{'title': event, 'payload': "/query_event{\"event\": \"%s\""} for event in matches]
        dispatcher.utter_button_message(" ",suggestions)

    return []

```

Any idea?

---

<div class="post-metadata">

### Author: ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)
#### Post date: [August 29, 2018, 2:36pm UTC](https://forum.rasa.com/t/using-dispatcher-utter-template-ended-with-exception/707/2 "2018-08-29T14:36:23Z")

</div>

Can you post the full error trace?

---

<div class="post-metadata">

### Author: ![leonardoaii71](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/leonardoaii71/32/458_2.png) [@leonardoaii71](https://forum.rasa.com/u/leonardoaii71)
#### Post date: [August 29, 2018, 7:35pm UTC](https://forum.rasa.com/t/using-dispatcher-utter-template-ended-with-exception/707/3 "2018-08-29T19:35:24Z")

</div>

Here it is:

when is the enrollment?

> C:\Users\Leonardo\Anaconda3\envs\BotProject\lib\site-packages\sklearn\preprocessing\label.py:151: DeprecationWarning: The truth value of an empty array is ambiguous. Returning False, but in future this will result in an error. Use `array.size > 0` to check that an array is not empty.

> ```
> if diff:
> 2018-08-29 15:16:20 ERROR rasa_core.processor - Encountered an exception while running action 'action_suggest'. Bot will continue, but the actions events are lost. Make sure to fix the exception in your custom code.
> 2018-08-29 15:16:20 ERROR rasa_core.processor - event to log must be an instance of a subclass of Event.
> Traceback (most recent call last):
> File "C:\Users\Leonardo\Anaconda3\envs\BotProject\lib\site-packages\rasa_core\processor.py", line 302, in _run_action
> events = action.run(dispatcher, tracker, self.domain)
> File "C:\Users\Leonardo\Documents\GitHub\starter-pack\actions.py", line 69, in run
> dispatcher.utter_template("utter_suggestions", tracker)
> File "C:\Users\Leonardo\Anaconda3\envs\BotProject\lib\site-packages\rasa_core\dispatcher.py", line 122, in utter_template
> message = self.retrieve_template(template, filled_slots, **kwargs)
> File "C:\Users\Leonardo\Anaconda3\envs\BotProject\lib\site-packages\rasa_core\dispatcher.py", line 157, in retrieve_template
> return self._fill_template_text(r, filled_slots, **kwargs)
> File "C:\Users\Leonardo\Anaconda3\envs\BotProject\lib\site-packages\rasa_core\dispatcher.py", line 136, in _fill_template_text
> template_vars = self._template_variables(filled_slots, kwargs)
> File "C:\Users\Leonardo\Anaconda3\envs\BotProject\lib\site-packages\rasa_core\dispatcher.py", line 132, in _template_variables
> template_vars.update(kwargs.items())
> File "C:\Users\Leonardo\Anaconda3\envs\BotProject\lib\site-packages\rasa_core\trackers.py", line 305, in update
> raise ValueError("event to log must be an instance "
> ValueError: event to log must be an instance of a subclass of Event.
> 
> ```

I edited my custom action to fill the template variables but it is the same even with no-variables templates.

```
    def run(self, dispatcher, tracker, domain):
    match = tracker.get_slot("date")
    matches = tracker.get_slot("matching_events")

    if match:
        dispatcher.utter_template("utter_ack_eventdate", tracker, event=tracker.get_slot('event'), 
        date=match)
        
    elif matches:
        dispatcher.utter_template("utter_suggestions", tracker)
        suggestions = [{'title': event, 'payload': "/query_event{\"event\": \"%s\""} for event in matches]
        dispatcher.utter_button_message("Quizás quisiste decir: ", suggestions)

    return []

```

---

<div class="post-metadata">

### Author: ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)
#### Post date: [August 31, 2018, 2:47pm UTC](https://forum.rasa.com/t/using-dispatcher-utter-template-ended-with-exception/707/4 "2018-08-31T14:47:46Z")

</div>

Can you post your domain file please? Also which Core version are you using?

---

<div class="post-metadata">

### Author: ![leonardoaii71](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/leonardoaii71/32/458_2.png) [@leonardoaii71](https://forum.rasa.com/u/leonardoaii71)
#### Post date: [August 31, 2018, 3:35pm UTC](https://forum.rasa.com/t/using-dispatcher-utter-template-ended-with-exception/707/5 "2018-08-31T15:35:47Z")

</div>

My rasa core version is 0.9.7

intents:

- greet
- thank
- bye
- deny
- affirm
- informar
- pedir\_info
- ofrecer\_info
- query\_date
- query\_event
- query\_process
- sorry

entities:

- event
- date

slots:

event:

```
type: unfeaturized

```

date:

```
type: unfeaturized

```

matching\_events:

```
type: list

```

username:

```
type: unfeaturized
initial_value: "human"

```

templates:

utter\_greet:

- text: “Hello {username}! I’m the register’s Bot, Tell me something you want to know.”

utter\_thank: - “You’re Welcome!”

utter\_bye:

- text: “Adios {username}.”
- text: “¡Bye-bye {username}!”
- text: “¡Hasta luego {username}!”
- text: “Hasta pronto, gracias por tu visita {username}!”

utter\_sorry:

- text: “Lo siento pero por el momento no puedo ayudarte.”

utter\_date:

- “You have one incoming event: Prematricula”

utter\_did\_that\_help:

- text: “¿Te sirvió de ayuda mi respuesta?”

utter\_happy:

- text: “Great!”
- text: “Me alegra escuchar eso!”

utter\_goodbye:

- text: “Bye”
- text: “Hasta luego!”
- text: “Adios!”

utter\_ack\_eventdate:

- text: “The {event} will be on {date}”

utter\_ask\_username:

- text: “¿Hola, para conocernos mejor, Cuál es tu nombre?”

utter\_another\_question:

- text: “Tienes otra pregunta {username}?”
- text: “Necesitas saber algo mas {username}?”

utter\_suggestions:

- text: “Creo que no entendí bien, quisiste decir:”
- text: “Por favor podrías ser mas especifico? intenta con:”

utter\_default:

- text: “Lo siento, no entendí tu pregunta, intenta con otra”

actions:

- utter\_greet
- utter\_thank
- utter\_bye
- utter\_sorry
- utter\_date
- utter\_did\_that\_help
- utter\_happy
- utter\_ack\_eventdate
- utter\_goodbye
- utter\_another\_question
- utter\_ask\_username
- utter\_default
- utter\_suggestions
- actions.ActionShowEventResults
- actions.ActionlookforEvent

---

<div class="post-metadata">

### Author: ![akelad](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/akelad/32/69_2.png) [@akelad](https://forum.rasa.com/u/akelad)
#### Post date: [September 4, 2018, 9:19am UTC](https://forum.rasa.com/t/using-dispatcher-utter-template-ended-with-exception/707/6 "2018-09-04T09:19:15Z")

</div>

Could you upgrade to a newer version, e.g. 0.10.4 or 0.11.2 to see if this issue persists?

---

<div class="post-metadata">

### Author: ![leonardoaii71](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/leonardoaii71/32/458_2.png) [@leonardoaii71](https://forum.rasa.com/u/leonardoaii71)
#### Post date: [September 8, 2018, 4:22pm UTC](https://forum.rasa.com/t/using-dispatcher-utter-template-ended-with-exception/707/7 "2018-09-08T16:22:45Z")

</div>

I have upgraded to 0.11 and this resolved the issue. The utter\_template() I was using is the one from the 0.10 version which is required to have the tracker as a second argument.

Thank you for helping!
