Error doing job: Task exception was never retrieved - TypeError

I know this error message has turned up in various releases - is this a new one:

2018-10-20 01:00:22 ERROR (MainThread) [homeassistant.core] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/automation/__init__.py", line 288, in async_trigger
    await self._async_action(self.entity_id, variables, context)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/components/automation/__init__.py", line 373, in action
    await script_obj.async_run(variables, context)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/script.py", line 173, in async_run
    await self._async_call_service(action, variables, context)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/script.py", line 206, in _async_call_service
    context=context
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/service.py", line 71, in async_call_from_config
    config[CONF_SERVICE_DATA_TEMPLATE], variables))
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/template.py", line 56, in render_complex
    for key, item in value.items()}
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/template.py", line 56, in <dictcomp>
    for key, item in value.items()}
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/template.py", line 57, in render_complex
    return value.async_render(variables)
  File "/srv/homeassistant/lib/python3.6/site-packages/homeassistant/helpers/template.py", line 132, in async_render
    return self._compiled.render(kwargs).strip()
  File "/srv/homeassistant/lib/python3.6/site-packages/jinja2/asyncsupport.py", line 76, in render
    return original_render(self, *args, **kwargs)
  File "/srv/homeassistant/lib/python3.6/site-packages/jinja2/environment.py", line 1008, in render
    return self.environment.handle_exception(exc_info, True)
  File "/srv/homeassistant/lib/python3.6/site-packages/jinja2/environment.py", line 780, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/srv/homeassistant/lib/python3.6/site-packages/jinja2/_compat.py", line 37, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 11, in top-level template code
TypeError: object of type 'NoneType' has no len()

I’m getting quite a few of them now on 79.x - I’ve upgraded to 0.80.3 - still getting them.

It is possible that I’ve upgraded a python library to a version that isnt supported, in a recent housekeeping overzealous upgrade rampage

My guess is you have a template under data_template in a service call in an automation that is trying to use the length filter on an expression that is evaluating to None instead of a string. E.g., you will see a similar error if you type this into the Templates editor:

{{ None|length }}

It must be a fairly complex template because it looks like the problem happens on line 11 of your template.

Hmm - ok - I’ve got a copy of the battery_alert package that was posted on here somewhere, that has data_templates and length checks. That is the only automation with both ‘length’ and data_template.

thanks - I’ll see if there is an update, or there is something messy with the way batteries have been detected.