Sure, "TypeError: '>' not supported between instances of 'str' and 'float'", but where?

I’m getting these in my logs. There’s nothing I see in the logs to indicate where the error in the template is.

2025-12-08 08:42:48.811 ERROR (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Error executing script. Error rendering template for variables at pos 1: TypeError: '>' not supported between instances of 'str' and 'float'

I looked through all my traces manually and nothing matches the timestamp of the error. The error was a 8:42 this morning, and it’s now 10:54 locally. The timestamps in trace.saved_traces are in UTC.

➜  .storage date -u
Mon Dec  8 18:54:31 UTC 2025
➜  .storage date
Mon Dec  8 10:54:32 PST 2025

So, two hours ago (at 8am) it was 16:48 UTC

➜  .storage fgrep 'start":' trace.saved_traces | grep 12-08T16:4 | wc -l
0

And the last trace for 16:xx hour is 16:29:10 UTC

➜  .storage fgrep 'start":' trace.saved_traces | grep 12-08T16: | sort | tail -1

            "start": "2025-12-08T16:29:10.705531+00:00",

Since no matching trace in there could it be a template in a Dashboard card instead of a script?

From the full log my guess is a variables: section in a template, but I haven’t found what script is running.

It doesn’t happen frequencly so leaving debug on isn’t great, or a sure bet debug level will give a hint where the issue is. I’m happy to add debugging code if I knew where.

Happens at odd times, too:

➜  .storage ha core logs -n 2000 | grep 'not supported between instances' | grep 2025 | cut -d ' ' -f 1,2
2025-12-07 11:31:26.758
2025-12-07 13:18:38.956
2025-12-07 13:54:11.020
2025-12-08 00:53:38.746
2025-12-08 02:31:07.344
2025-12-08 04:36:19.542
2025-12-08 08:42:48.811

Thanks.

Full log message
2025-12-08 08:42:48.811 ERROR (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Error executing script. Error rendering template for variables at pos 1: TypeError: '>' not supported between instances of 'str' and 'float'
2025-12-08 08:43:14.742 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved (None)
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template/__init__.py", line 469, in async_render
    render_result = render_with_context(self.template, compiled, **kwargs)
  File "/usr/src/homeassistant/homeassistant/helpers/template/context.py", line 45, 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 1, in top-level template code
TypeError: '>' not supported between instances of 'str' and 'float'

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

Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/template/coordinator.py", line 140, in _handle_triggered_with_script
    if script_result := await self._script.async_run(run_variables, script_context):
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 1833, in async_run
    return await asyncio.shield(create_eager_task(run.async_run()))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 460, in async_run
    await self._async_step(log_exceptions=False)
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 526, in _async_step
    self._handle_exception(
    ~~~~~~~~~~~~~~~~~~~~~~^
        ex, continue_on_error, self._log_exceptions or log_exceptions
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 556, in _handle_exception
    raise exception
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 524, in _async_step
    await getattr(self, handler)()
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 973, in _async_step_variables
    self._action[CONF_VARIABLES].async_simple_render(self._variables)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script_variables.py", line 81, in async_simple_render
    rendered_variable = template.render_complex(value, run_variables)
  File "/usr/src/homeassistant/homeassistant/helpers/template/__init__.py", line 218, in render_complex
    return value.async_render(variables, limited=limited, parse_result=parse_result)
           ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template/__init__.py", line 471, in async_render
    raise TemplateError(err) from err

Just another example of an error without any context (e.g. dashboard/automation/source line) is causing the error. In this (frontend) case could there be a URL included?

2026-02-11 08:48:17.499 ERROR (MainThread) [frontend.js.modern.202601286] Uncaught error from Chrome 144.0.0.0 on macOS 10.15.7
TypeError: Cannot use 'in' operator to search for 'delay' in c
hasTemplate (src/data/script.ts:336:6)
of (src/data/script.ts:489:21)
Array.isArray (src/data/script.ts:438:18)
migrateAutomationAction (src/data/script.ts:519:6)
Array.isArray (src/data/script.ts:438:18)
migrateAutomationTrigger (src/data/automation.ts:456:45)
saveAutomationConfig (src/data/automation.ts:413:11)
ev.stopPropagation (src/panels/config/automation/ha-automation-editor.ts:854:35)

This is coming from a trigger based template entity. Post all of them and I can tell you which one it is. If I can replicate these types of exceptions, I can improve the error message to point to an entity. But understand that if this occurs in the trigger itself, I cannot provide an entity because triggers can attach to multiple template entities and the trigger doesn’t know which entities it’s attached to.

That error is a frontend error. frontend.js.modern.202601286, unrelated to the error in the original post (which I can help with).

Oh, so is it the file “/usr/src/homeassistant/homeassistant/components/template/coordinator.py” that indicates it’s a template sensor? I guess I was assuming it was just any template, which could include automations/dashboard, but “component” should have been the hint, right?

That narrows it down. I have about 30 template sensors so I’ll look through and see where I might be missing a float.

Yes, the frontend isn’t related. It’s just hard when the error doesn’t give enough context to track it down, as I’m sure you are well aware.

It doesn’t appear that compiled Jinja objects keep their source, right? Something that might be used to track the source down.

That file indicates specifically trigger based template entities.

Templates do not track the entity they are associated with. Most templates aren’t associated with entities

What I mean was more if when the template is compiled the source is saved in the object (or file/line number, if known at the time) which could then be used in exceptions. Doesn’t sound like Jinja does that.

Probably not catching everything, but maybe “cur_sum”?

➜  config fgrep -rh  -A 40 triggers: packages  | grep '>' | grep -v ': >'
              {% if as_datetime(event.start) > now() %}
          new_value: "{{ 0.0 if cur_sum > 0.05 else cur_sum }}"

Is there a string conversion in here?

➜  config fgrep -rh  -B2 new_value: packages
      - variables:
          cur_sum: "{{ trigger.to_state.state|float(0) + states('sensor.droplet_total_excluded')|float(0) }}"
          new_value: "{{ 0.0 if cur_sum > 0.05 else cur_sum }}"

Nothing in HA does that.

Is that a trigger based template entity? This should be really easy to look for in your config.

Also, it’s going to be in the action: section of a trigger based template entity. i.e.

triggers:
...
action:
- #HERE
sensor|binary_sensor|etc:
- name:

That’s helpful.

BTW, this does NOT generate an error (and it’s not in the action). i.e. no string conversion.

➜  config cat packages/foo.yaml
template:
  - triggers:
      - trigger: state
        entity_id: input_boolean.test_generic
    variables:
      foo: "{{ 123.456|float(0) }}"
      bar: "{{ 'greater than' if 123.45 > foo else 'less than' }}"
    sensor:
      - name: Test Compare
        unique_id: test_compare_id
        state: "{{ bar }}"

The template needs to have a greater-than sign, correct? Nothing here.

➜  config fgrep action: template_sensors.yaml
➜  config fgrep -rh -A 10 action: packages | grep '>' | grep -v ': >'
              prog: "{{ state_attr('sensor.sprinkler_queue','prog') if queue|length > 1 else '' }}"
                value_template: "{{ next_valve|length > 0 }}"
            {{ trigger.entity_id }}: '{{ trigger.from_state.state }}' => '{{ trigger.to_state.state }}'
        value: "{% set delta = target - cur_pos %} {% if delta|abs > 10 %}\n  {% set
          delta = 10 if delta > 0 else -10 %}\n{% endif %} {{ cur_pos + delta }}\n"
        value: "{% set delta = target - cur_pos %} {% if delta|abs > 10 %}\n  {% set
          delta = 10 if delta > 0 else -10 %}\n{% endif %} {{ cur_pos + delta }}\n"

I just looked at every place there was an “action:” and haven’t found it yet.

➜  config grep -rl action: packages | wc -l
10
➜  config for x in `grep -rl action: packages`; do less $x; done
Doesn't happen that often, I guess.
➜  config ha core logs -n 5000 | grep float
2026-02-10 14:59:06.421 ERROR (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Error executing script. Error rendering template for variables at pos 1: TypeError: '>' not supported between instances of 'str' and 'float'
TypeError: '>' not supported between instances of 'str' and 'float'
homeassistant.exceptions.TemplateError: TypeError: '>' not supported between instances of 'str' and 'float'
2026-02-10 16:45:54.649 ERROR (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Error executing script. Error rendering template for variables at pos 1: TypeError: '>' not supported between instances of 'str' and 'float'
TypeError: '>' not supported between instances of 'str' and 'float'
homeassistant.exceptions.TemplateError: TypeError: '>' not supported between instances of 'str' and 'float'
2026-02-10 20:49:39.380 ERROR (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Error executing script. Error rendering template for variables at pos 1: TypeError: '>' not supported between instances of 'str' and 'float'
TypeError: '>' not supported between instances of 'str' and 'float'
homeassistant.exceptions.TemplateError: TypeError: '>' not supported between instances of 'str' and 'float'
2026-02-10 22:31:27.569 ERROR (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Error executing script. Error rendering template for variables at pos 1: TypeError: '>' not supported between instances of 'str' and 'float'
TypeError: '>' not supported between instances of 'str' and 'float'
homeassistant.exceptions.TemplateError: TypeError: '>' not supported between instances of 'str' and 'float'
2026-02-10 23:49:15.999 ERROR (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Error executing script. Error rendering template for variables at pos 1: TypeError: '>' not supported between instances of 'str' and 'float'
TypeError: '>' not supported between instances of 'str' and 'float'
homeassistant.exceptions.TemplateError: TypeError: '>' not supported between instances of 'str' and 'float'
➜  config

the key could be action or actions.

The string will be on the left and the number will be on the right.

it’s not going to be the > 0 one because 0 is an int.

it’s not going to be the length one because that only returns an int.

Well, thanks for helping.

I went through all the possible YAML files and in each one searched for > and everything had either a float, length, or abs filter.

I also tried looking at those log timestamps in the events db table to see what state change might have led to the template running. And also looked at the states table, but I guess if it’s causing an exception nothing would end up there.

Just even grep’ing around for all templates with a > and nothing jumps out.

➜  config fgrep -rh -A 10 '{{' packages | grep '>' | grep -v ': >'
      bar: "{{ 'greater than' if 123.45 > foo else 'less than' }}"
          {{ new_val if new_val >= 0.0 and new_val <= 100.0 else this.state }}
              {% if as_datetime(event.start) > now() %}
              prog: "{{ state_attr('sensor.sprinkler_queue','prog') if queue|length > 1 else '' }}"
                  prog: "{{ state_attr('sensor.sprinkler_queue','prog') if queue|length > 1 else '' }}"
                value_template: "{{ next_valve|length > 0 }}"
            | count > 1
            {{ trigger.entity_id }}: '{{ trigger.from_state.state }}' => '{{ trigger.to_state.state }}'
            value_template: '{{ flow_difference|abs > range_limit }}'
          new_value: "{{ 0.0 if cur_sum > 0.05 else cur_sum }}"
        value: "{% set delta = target - cur_pos %} {% if delta|abs > 10 %}\n  {% set
          delta = 10 if delta > 0 else -10 %}\n{% endif %} {{ cur_pos + delta }}\n"
        value: "{% set delta = target - cur_pos %} {% if delta|abs > 10 %}\n  {% set
          delta = 10 if delta > 0 else -10 %}\n{% endif %} {{ cur_pos + delta }}\n"

All I’m finding is stuff that I’d like to refactor…

remove the {{

or do an or function including {{ }} {% and %}

➜  config fgrep -rh -A 10 '{%' packages | grep '>' | grep -v ': >'
          {{ new_val if new_val >= 0.0 and new_val <= 100.0 else this.state }}
              {% if as_datetime(event.start) > now() %}
        value: "{% set delta = target - cur_pos %} {% if delta|abs > 10 %}\n  {% set
          delta = 10 if delta > 0 else -10 %}\n{% endif %} {{ cur_pos + delta }}\n"
        value: "{% set delta = target - cur_pos %} {% if delta|abs > 10 %}\n  {% set
          delta = 10 if delta > 0 else -10 %}\n{% endif %} {{ cur_pos + delta }}\n"

I’m doing -A 10, so figure I don’t need the ending tags.

It’s only possible as a template with a trigger? Only place those could be are in a package and in my template_sensors.yaml file, right?

Anything I might add to the code to tell me more when the exception happens?

Any template entity…

Correct

I’ve looked at all of them. I have 16 package files.

I just now updated my config to only load three critical ones (e.g. hvac, security) and will let that run and see if the error shows up again. (Spook is complaining now as expected.)

Would be a lot easier if I knew how to trigger it. Seems like it does happen a few times a day at somewhat random times, so maybe in a day or so will get a better idea.

If it’s a template with a trigger wouldn’t you expect to see something in the Database at these times?

➜  packages ha core logs -n 20000 | grep float | grep ERROR
2026-02-09 17:34:06.477 ERROR (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Error executing script. Error rendering template for variables at pos 1: TypeError: '>' not supported between instances of 'str' and 'float'
2026-02-10 05:55:41.321 ERROR (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Error executing script. Error rendering template for variables at pos 1: TypeError: '>' not supported between instances of 'str' and 'float'
2026-02-10 13:02:34.312 ERROR (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Error executing script. Error rendering template for variables at pos 1: TypeError: '>' not supported between instances of 'str' and 'float'
2026-02-10 14:59:06.421 ERROR (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Error executing script. Error rendering template for variables at pos 1: TypeError: '>' not supported between instances of 'str' and 'float'
2026-02-10 16:45:54.649 ERROR (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Error executing script. Error rendering template for variables at pos 1: TypeError: '>' not supported between instances of 'str' and 'float'
2026-02-10 20:49:39.380 ERROR (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Error executing script. Error rendering template for variables at pos 1: TypeError: '>' not supported between instances of 'str' and 'float'
2026-02-10 22:31:27.569 ERROR (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Error executing script. Error rendering template for variables at pos 1: TypeError: '>' not supported between instances of 'str' and 'float'
2026-02-10 23:49:15.999 ERROR (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Error executing script. Error rendering template for variables at pos 1: TypeError: '>' not supported between instances of 'str' and 'float'
2026-02-11 15:10:45.877 ERROR (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Error executing script. Error rendering template for variables at pos 1: TypeError: '>' not supported between instances of 'str' and 'float'
2026-02-11 15:12:45.827 ERROR (MainThread) [homeassistant.helpers.script.trigger_update_coordinator] Trigger Update Coordinator: Error executing script. Error rendering template for variables at pos 1: TypeError: '>' not supported between instances of 'str' and 'float'
➜  packages

No, the error stops it from moving forward. It’s not a trigger either. It’s a trigger based template entity. The action section has it.

Are you using template blueprints?

Right, but if there was an event in the DB at that same time as the error that might lead me to the event that triggered the it – and then look at the action. I think I already tried that approach and didn’t get anything useful.

➜  config find blueprints  -name '*.yaml'
blueprints/automation/homeassistant/notify_leaving_zone.yaml
blueprints/automation/homeassistant/motion_light.yaml
blueprints/automation/Blackshome/low-battery-notifications-and-actions.yaml
blueprints/automation/Participant/minoston-mr40z-s2-remote-control-switch-z-wave-scene-controller.yaml
blueprints/template/homeassistant/inverted_binary_sensor.yaml
blueprints/script/homeassistant/confirmable_notification.yaml

➜  blueprints fgrep -rh -A20 '{%' . | grep '>'
➜  blueprints fgrep -rh -A20 '{{' . | grep '>'
      value_template: '{{ notify_device | length > 0 }}'
      value_template: '{{ notify_device | length > 0 }}'
➜  blueprints