End of my tether: Error while processing template: Template<template=(mushroom-shape-icon

I’ve spent the last day trying to figure out what the issue is, it seems to have manifested since the latest HA update and it killing my HA instance. This is flying through the logs repeating over and over. :cry:

2025-01-13 08:52:58.749 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=(mushroom-shape-icon {
  {% set vol_level = state_attr(config.entity, 'volume_level') | float %}
  --card-mod-icon:
  {% if state_attr(config.entity, 'is_volume_muted') == true %}
    mdi:volume-mute
  {% else %}
    {% if vol_level > 0.66 %}
      mdi:volume-high
    {% elif vol_level < 0.33 %}
      mdi:volume-low
    {% else %}
      mdi:volume-medium
    {% endif %}
  {% endif %};
}) renders=30362>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2364, in forgiving_float_filter
    return float(value)
TypeError: float() argument must be a string or a real number, not 'NoneType'
During handling of the above exception, another exception occurred:
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 2745, 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 "
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2367, in forgiving_float_filter
    raise_no_default("float", value)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1921, in raise_no_default
    raise ValueError(
    ...<2 lines>...
    )
ValueError: Template error: float got invalid input 'None' when rendering template 'mushroom-shape-icon {
  {% set vol_level = state_attr(config.entity, 'volume_level') | float %}
  --card-mod-icon:
  {% if state_attr(config.entity, 'is_volume_muted') == true %}
    mdi:volume-mute
  {% else %}
    {% if vol_level > 0.66 %}
      mdi:volume-high
    {% elif vol_level < 0.33 %}
      mdi:volume-low
    {% else %}
      mdi:volume-medium
    {% endif %}
  {% endif %};
}' but no default was specified
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: ValueError: Template error: float got invalid input 'None' when rendering template 'mushroom-shape-icon {
  {% set vol_level = state_attr(config.entity, 'volume_level') | float %}
  --card-mod-icon:
  {% if state_attr(config.entity, 'is_volume_muted') == true %}
    mdi:volume-mute
  {% else %}
    {% if vol_level > 0.66 %}
      mdi:volume-high
    {% elif vol_level < 0.33 %}
      mdi:volume-low
    {% else %}
      mdi:volume-medium
    {% endif %}
  {% endif %};
}' but no default was specified
2025-01-13 08:52:58.751 ERROR (MainThread) [homeassistant.helpers.event] Error while processing template: Template<template=(mushroom-shape-icon {
  {% set vol_level = state_attr(config.entity, 'volume_level') | float %}
  --card-mod-icon:
  {% if state_attr(config.entity, 'is_volume_muted') == true %}
    mdi:volume-mute
  {% else %}
    {% if vol_level > 0.66 %}
      mdi:volume-high
    {% elif vol_level < 0.33 %}
      mdi:volume-low
    {% else %}
      mdi:volume-medium
    {% endif %}
  {% endif %};
}) renders=30364>
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2364, in forgiving_float_filter
    return float(value)
TypeError: float() argument must be a string or a real number, not 'NoneType'
During handling of the above exception, another exception occurred:
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 2745, 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 "
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 2367, in forgiving_float_filter
    raise_no_default("float", value)
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/template.py", line 1921, in raise_no_default
    raise ValueError(
    ...<2 lines>...
    )
ValueError: Template error: float got invalid input 'None' when rendering template 'mushroom-shape-icon {
  {% set vol_level = state_attr(config.entity, 'volume_level') | float %}
  --card-mod-icon:
  {% if state_attr(config.entity, 'is_volume_muted') == true %}
    mdi:volume-mute
  {% else %}
    {% if vol_level > 0.66 %}
      mdi:volume-high
    {% elif vol_level < 0.33 %}
      mdi:volume-low
    {% else %}
      mdi:volume-medium
    {% endif %}
  {% endif %};
}' but no default was specified
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: ValueError: Template error: float got invalid input 'None' when rendering template 'mushroom-shape-icon {
  {% set vol_level = state_attr(config.entity, 'volume_level') | float %}
  --card-mod-icon:
  {% if state_attr(config.entity, 'is_volume_muted') == true %}
    mdi:volume-mute
  {% else %}
    {% if vol_level > 0.66 %}
      mdi:volume-high
    {% elif vol_level < 0.33 %}
      mdi:volume-low
    {% else %}
      mdi:volume-medium
    {% endif %}
  {% endif %};
}' but no default was specified

I found that I had a few Mushroom Media Card’s with the following card-mods which matched the error. I have since removed this config and restarted HA but it’s not gone away.

Before:

type: custom:mushroom-media-player-card
show_volume_level: true
volume_controls:
  - volume_set
  - volume_mute
  - volume_buttons
use_media_info: false
layout_options:
  grid_columns: 4
  grid_rows: 2
entity: media_player.revo
name: Kitchen
card_mod:
  style: |
    mushroom-shape-icon {
      {% set vol_level = state_attr(config.entity, 'volume_level') | float %}
      --card-mod-icon:
      {% if state_attr(config.entity, 'is_volume_muted') == true %}
        mdi:volume-mute
      {% else %}
        {% if vol_level > 0.66 %}
          mdi:volume-high
        {% elif vol_level < 0.33 %}
          mdi:volume-low
        {% else %}
          mdi:volume-medium
        {% endif %}
      {% endif %};
    }

After

type: custom:mushroom-media-player-card
show_volume_level: true
volume_controls:
  - volume_set
  - volume_mute
  - volume_buttons
use_media_info: false
layout_options:
  grid_columns: 4
  grid_rows: 2
entity: media_player.revo
name: Kitchen

I ended up having to do a restore and it all seems ok now. :grinning:

WTH. It’s back in the logs :cry:

Same error, I’ve scoured the dashboards and I cannot see this configuration anywhere.

I’m out of ideas. Can anyone suggest how I can weed this out?

I have looked through all the JSON files for any dashboards I have in the.storage folder and none of this config pertaining to that error is there

That float parsing have no default value specified and it cause issues, when. The volune_level can not be retreived.

Do you have a tablet displaying the dashboard somewhere that needs to be refreshed?