Errors in log stay, even after changing

Hi,

I saw these errors in my log :

Logger: homeassistant.helpers.event
Source: helpers/template.py:645
First occurred: 13:28:20 (12 occurrences)
Last logged: 13:28:20

Error while processing template: Template<template=({% if states('vacuum.roborock_q8_max') == 'unavailable' %} Niet bereikbaar {% else %} nog {{ ((states("sensor.roborock_q8_max_side_brush_left") | int ) / 3600) | round(0) }} uren ({{ ((((states("sensor.roborock_q8_max_side_brush_left") | int(0) ) / 3600) / 200) * 100)| round(0, 'ceil') }}%) {% endif %}) renders=6>
Error while processing template: Template<template=({% set vacrooms = namespace(roomtot=0) %} {% for rooms in state_attr('sensor.roborock_rooms','rooms') -%} {% if is_state(rooms.boolean,'on') %} {% set vacrooms.roomtot = vacrooms.roomtot + 1 %} {% endif %} {%- endfor %} {% if vacrooms.roomtot > 0 %} green {% else %} grey {% endif %}) renders=8>
Error while processing template: Template<template=({% if states('vacuum.roborock_q8_max') == 'unavailable' %} Niet bereikbaar {% else %} nog {{ ((states("sensor.roborock_q8_max_filter_left") | int ) / 3600) | round(0) }} uren ({{ ((((states("sensor.roborock_q8_max_filter_left") | int(0) ) / 3600) / 150) * 100)| round(0, 'ceil') }}%) {% endif %}) renders=8>
Error while processing template: Template<template=({% if states('vacuum.roborock_q8_max') == 'unavailable' %} Niet bereikbaar {% else %} nog {{ ((states("sensor.roborock_q8_max_main_brush_left") | int ) / 3600) | round(0) }} uren ({{ ((((states("sensor.roborock_q8_max_main_brush_left") | int(0) ) / 3600) / 300) * 100)| round(0, 'ceil') }}%) {% endif %}) renders=8>
Error while processing template: Template<template=({% if states('vacuum.roborock_q8_max') == 'unavailable' %} Niet bereikbaar {% else %} nog {{ ((states("sensor.roborock_q8_max_side_brush_left") | int ) / 3600) | round(0) }} uren ({{ ((((states("sensor.roborock_q8_max_side_brush_left") | int(0) ) / 3600) / 200) * 100)| round(0, 'ceil') }}%) {% endif %}) renders=8>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 643, in async_render
    render_result = _render_with_context(self.template, compiled, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2756, in _render_with_context
    return template.render(**kwargs)
           ~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/jinja2/environment.py", line 1295, in render
    self.environment.handle_exception()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/local/lib/python3.13/site-packages/jinja2/environment.py", line 942, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<template>", line 2, in top-level template code
TypeError: 'NoneType' object is not iterable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 760, in async_render_to_info
    render_info._result = self.async_render(  # noqa: SLF001
                          ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
        variables, strict=strict, log_fn=log_fn, **kwargs
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 645, in async_render
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: TypeError: 'NoneType' object is not iterable

These templates are on my dashbord, so I made some modifications :

                          secondary: |
                            {% if not has_value('vacuum.roborock_q8_max') %}
                              Niet bereikbaar
                            {% else %}
                              nog {{ ((states("sensor.roborock_q8_max_side_brush_left") | int ) / 3600) | round(0)  }} uren
                              
                              ({{ ((((states("sensor.roborock_q8_max_side_brush_left") | int(0) ) / 3600) / 200) * 100)|
                              round(0, 'ceil') }}%)
                            {% endif %}

                icon_color: >
                  {% set vacrooms = namespace(roomid=[]) %} {% for rooms in
                  state_attr('sensor.roborock_rooms','rooms') -%}
                    {% if is_state(rooms.boolean,'on') %}
                      {% set vacrooms.roomid = vacrooms.roomid + [rooms.id] %}
                    {% endif %}
                  {%- endfor %} {% if vacrooms.roomid |count > 0 %}
                    green
                  {% else %}
                    grey
                  {% endif %}

                          secondary: |
                            {% if not has_value('vacuum.roborock_q8_max') %}
                              Niet bereikbaar
                            {% else %}
                              nog {{ ((states("sensor.roborock_q8_max_filter_left") | int ) / 3600) | round(0)  }} uren

                              ({{ ((((states("sensor.roborock_q8_max_filter_left") | int(0) ) / 3600) / 150) * 100)|
                              round(0, 'ceil') }}%)
                            {% endif %}

                          secondary: |
                            {% if not has_value('vacuum.roborock_q8_max') %}
                              Niet bereikbaar
                            {% else %}
                              nog {{ ((states("sensor.roborock_q8_max_main_brush_left") | int ) / 3600) | round(0)  }} uren
                              ({{ ((((states("sensor.roborock_q8_max_main_brush_left") | int(0) ) / 3600) / 300) * 100)|
                              round(0, 'ceil') }}%)
                            {% endif %}

But now when I restart HA I still get these errors with the old code ??

What do I miss here ?

I came here to ask this same thing. Had errors in my templates when converting to float because the sensors weren’t ready yet. Added a 0 default, and still getting the error

I had a similar experience. It turned out that HA was displaying the previous log after the reboot. I ssh’d into the system and checked the current log and there were no errors. The browser had cached the previous log.