General help needed in tracking down protocol errors

Hello there

I do need some general advice on how to track down errors showing in the log/protocol. I’m certainly not a newbie but definitly not a programmer language speaking person😅 and any help is appreciated.

So I’m looking for a “general way” to solve those errors, how to start tackling them.

Like on different occasions I get “Error while processing template: … … renders=2>”, also in below protocolls copy

I’ve tried to search forums, google, for quite a while for different such errors etc. but was either unable to find any solution that helps me understand why my issue occurs nor to understand the reason for the error at all. So someone more capable might be able to enrich my capabilities about that “renders=” error?

Also I see there are references to codelines (for example “Traceback (most recent call last):
File “/usr/src/homeassistant/homeassistant/helpers/template.py”, line 587, in ensure_valid”) where they seem to occur but I don’t get where to start looking for them or how to find that location of the code. I assume is to do with a template I’ve created but sometimes I do not see which one…

Logger: homeassistant.helpers.event
Quelle: helpers/template.py:589
Erstmals aufgetreten: 10. März 2025 um 19:58:59 (12 Vorkommnisse)
Zuletzt protokolliert: 10. März 2025 um 20:00:16

Error while processing template: Template<template=({% if is_state('binary_sensor.pending_updates', 'on') and states('sensor.pending_updates')|int(0) > 15 and is_state('binary_sensor.updates_paused', 'off') %}red {% elif is_state('binary_sensor.pending_updates', 'on') and states('sensor.pending_updates')|int(0) > 15 and is_state('binary_sensor.updates_paused', 'on') %}orange {% elif (is_state('binary_sensor.updates_paused', 'off')is_state('binary_sensor.pending_updates', 'on') and is_state('schedule.update_system', 'on')) or states('sensor.pending_updates')|int(0) > 10 or is_state('update.home_assistant_core_update', 'on') or is_state('update.home_assistant_operating_system_update', 'on') or is_state('update.home_assistant_supervisor_update', 'on') %}orange {% elif is_state('binary_sensor.pending_updates', 'on') %}blue {% else %}green {% endif %}) renders=2>
Error while processing template: Template<template=({% if is_state('binary_sensor.pending_updates', 'on') and states('sensor.pending_updates')|int(0) > 15 and is_state('binary_sensor.updates_paused', 'off') %}red {% elif is_state('binary_sensor.pending_updates', 'on') and states('sensor.pending_updates')|int(0) > 15 and is_state('binary_sensor.updates_paused', 'on') %}orange {% elif (is_state('binary_sensor.updates_paused', 'off') is_state('binary_sensor.pending_updates', 'on') and is_state('schedule.update_system', 'on')) or states('sensor.pending_updates')|int(0) > 10 or is_state('update.home_assistant_core_update', 'on') or is_state('update.home_assistant_operating_system_update', 'on') or is_state('update.home_assistant_supervisor_update', 'on') %}orange {% elif is_state('binary_sensor.pending_updates', 'on') %}blue {% else %}green {% endif %}) renders=2>
Error while processing template: Template<template=({% if is_state('binary_sensor.pending_updates', 'on') and states('sensor.pending_updates')|int(0) > 15 and is_state('binary_sensor.updates_paused', 'off') %}red {% elif is_state('binary_sensor.pending_updates', 'on') and states('sensor.pending_updates')|int(0) > 15 and is_state('binary_sensor.updates_paused', 'on') %}orange {% elif (is_state('binary_sensor.updates_paused', 'off') ais_state('binary_sensor.pending_updates', 'on') and is_state('schedule.update_system', 'on')) or states('sensor.pending_updates')|int(0) > 10 or is_state('update.home_assistant_core_update', 'on') or is_state('update.home_assistant_operating_system_update', 'on') or is_state('update.home_assistant_supervisor_update', 'on') %}orange {% elif is_state('binary_sensor.pending_updates', 'on') %}blue {% else %}green {% endif %}) renders=2>
Error while processing template: Template<template=({% if is_state('binary_sensor.pending_updates', 'on') and states('sensor.pending_updates')|int(0) > 15 and is_state('binary_sensor.updates_paused', 'off') %}red {% elif is_state('binary_sensor.pending_updates', 'on') and states('sensor.pending_updates')|int(0) > 15 and is_state('binary_sensor.updates_paused', 'on') %}orange {% elif (is_state('binary_sensor.updates_paused', 'off') anis_state('binary_sensor.pending_updates', 'on') and is_state('schedule.update_system', 'on')) or states('sensor.pending_updates')|int(0) > 10 or is_state('update.home_assistant_core_update', 'on') or is_state('update.home_assistant_operating_system_update', 'on') or is_state('update.home_assistant_supervisor_update', 'on') %}orange {% elif is_state('binary_sensor.pending_updates', 'on') %}blue {% else %}green {% endif %}) renders=2>
Error while processing template: Template<template=({% if is_state('binary_sensor.pending_updates', 'on') and states('sensor.pending_updates')|int(0) > 15 and is_state('binary_sensor.updates_paused', 'off') %}red {% elif is_state('binary_sensor.pending_updates', 'on') and states('sensor.pending_updates')|int(0) > 15 and is_state('binary_sensor.updates_paused', 'on') %}orange {% elif (is_state('binary_sensor.updates_paused', 'off') andis_state('binary_sensor.pending_updates', 'on') and is_state('schedule.update_system', 'on')) or states('sensor.pending_updates')|int(0) > 10 or is_state('update.home_assistant_core_update', 'on') or is_state('update.home_assistant_operating_system_update', 'on') or is_state('update.home_assistant_supervisor_update', 'on') %}orange {% elif is_state('binary_sensor.pending_updates', 'on') %}blue {% else %}green {% endif %}) renders=2>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 587, in ensure_valid
    self._compiled_code = self._env.compile(self.template)
                          ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 3233, in compile
    compiled = super().compile(source)
  File "/usr/local/lib/python3.13/site-packages/jinja2/environment.py", line 771, in compile
    self.handle_exception(source=source_hint)
    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.13/site-packages/jinja2/environment.py", line 942, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "<unknown>", line 1, in template
jinja2.exceptions.TemplateSyntaxError: expected token 'end of statement block', got 'a'

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 637, in async_render
    compiled = self._compiled or self._ensure_compiled(limited, strict, log_fn)
                                 ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 841, in _ensure_compiled
    self.ensure_valid()
    ~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 589, in ensure_valid
    raise TemplateError(err) from err
homeassistant.exceptions.TemplateError: TemplateSyntaxError: expected token 'end of statement block', got 'a'

For context:
I’m running HASS OS on a Beelink S12 pro with an external Zigbee Antenna (SMLIGHT SLZB-06M) connected over PoE and using ZHA
Current Versions:

  • Core 2025.2.5
  • Supervisor 2025.03.2
  • Operating System 14.2
  • Frontend 20250221.0

Here is another one, this time from the supervisor protocoll, which I do not get at all what it means:
“ERROR (MainThread) [aiohttp.server] Error handling request from 172.30.33.2” (My Internal IP is 172.26. I do not have created adresses of 172.30.)

anyone willing to help?

You have syntax errors in that template. Without seeing the formatted template, it’s hard to help.

From what I can see, you’re missing a space between an and and is_state.

@petro is a master at templating, so listen to him.

I absolutely suck at templates, but even I can see that there are multiple typos & syntax errors in the code you posted:

  • First row is missing a space and and
  • Second row is missing and
  • Third row should be and is_state, not ais_state
  • Fourth row should be and is_state, not anis_state
  • Fifth row should be and is_state, not andis_state

172.30 is the address for the internal Docker containers HA uses. It’s not your IP network. Looks like that error is coming from an integration (Alexa?) which is having some issues connecting to the internet.

Hi petro
Thanks for those hints. I already realized that but I am struggling how or where to locate them. how/where would you start searching for this issue?

Use a text editor like VSCode or something similar to search your configuration.

sure, I know that this is incorrect. but I can’t remember where i put it and struggle to locate the position of those faults…:man_shrugging: so where to find them or whats the way to search them?

… 172.30… that’s good to know at the first place :muscle:. it’s definetly not alexa - never had it and never will :sweat_smile: any idea how to find /locate/pinpoint to that issue?

You can check:Error

for others trying the same, all the hints above plus copy&paste the HA log message into an AI does help a lot!