Help me diagnose this error in my log

I get this from time to time showing up in my home-assistant.log file. Can’t seem to see any pattern. Can anyone help me try to figure out if this is a bug or caused by something in my config? If it is my config (which I suspect), how can I figure out where my error is coming fromm?

2019-11-21 22:35:27 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/hass-3.8/lib/python3.8/site-packages/homeassistant/components/automation/__init__.py", line 298, in async_trigger
    if not skip_condition and not self._cond_func(variables):
  File "/srv/hass-3.8/lib/python3.8/site-packages/homeassistant/components/automation/__init__.py", line 460, in if_action
    return all(check(hass, variables) for check in checks)
  File "/srv/hass-3.8/lib/python3.8/site-packages/homeassistant/components/automation/__init__.py", line 460, in <genexpr>
    return all(check(hass, variables) for check in checks)
  File "/srv/hass-3.8/lib/python3.8/site-packages/homeassistant/helpers/condition.py", line 387, in template_if
    return async_template(hass, value_template, variables)
  File "/srv/hass-3.8/lib/python3.8/site-packages/homeassistant/helpers/condition.py", line 367, in async_template
    value = value_template.async_render(variables)
  File "/srv/hass-3.8/lib/python3.8/site-packages/homeassistant/helpers/template.py", line 220, in async_render
    return compiled.render(kwargs).strip()
  File "/srv/hass-3.8/lib/python3.8/site-packages/jinja2/asyncsupport.py", line 76, in render
    return original_render(self, *args, **kwargs)
  File "/srv/hass-3.8/lib/python3.8/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/srv/hass-3.8/lib/python3.8/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/srv/hass-3.8/lib/python3.8/site-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 2, in <module>
  File "/srv/hass-3.8/lib/python3.8/site-packages/jinja2/sandbox.py", line 440, in call
    return __context.call(__obj, *args, **kwargs)
TypeError: 'bool' object is not callable```

If it is your config, I’d start by checking your service templates for the possibility that they evaluate to something that is not a service.

Also maybe try increasing the default log level for more info. Don’t forget to set it back afterwards though. It can be quite chatty and not good for SD cards.

That definitely helped. I was able to narrow down the error to a state change in one of my media_player entities. Then I had to track down everywhere I was using that in a template, and I finally found a logic error where I had neglected to put an ‘and’ between two boolean statements. It was not easy to see!

2 Likes