HA 2026.5 Broke some UI-Minimalist dashboards, this is the fix (ButtonCardJSTemplateError)

The original GitHub fix here helps, but it did not completely solve the frontend crash. The remaining issue was that some UI Lovelace Minimalist card templates still assumed that entity and entity.attributes always exist. When Home Assistant loaded certain cards, those values were sometimes undefined during rendering. The additional fixes were made in these files:

.../ulm_templates/card_templates/2-line_cards/card_graph.yaml

and

.../ulm_templates/card_templates/cards/card_light.yaml

In card_graph.yaml, these unsafe references were changed:

entity.attributes.friendly_name
entity.attributes.icon

to safer versions using optional chaining and fallback values:

entity?.attributes?.friendly_name || entity?.entity_id || ''
entity?.attributes?.icon || 'mdi:chart-line'

In card_light.yaml, these unsafe references were changed:

entity.attributes.friendly_name
entity.attributes.icon
entity.attributes.rgb_color
entity.attributes.brightness

to safer versions:

entity?.attributes?.friendly_name || entity?.entity_id || ''
entity?.attributes?.icon || 'mdi:lightbulb'
entity?.attributes?.rgb_color
entity?.attributes?.brightness

After those changes and a Home Assistant restart, the frontend crash was fixed.

So the full fix was not only the translation/localize change from the original GitHub issue. The card templates also needed defensive checks anywhere they directly accessed entity.attributes, because entity or entity.attributes may not always be available at render time.

2 Likes

Thank you for troubleshooting the issue and finding a fix! :sweat_smile:

1 Like