Failed to initiate automation when HA starts with strange error log

Hi there. There was a power outage this morning and my HA server restarted. However, an error popped up related to automation, and all my automation disappeared. May I ask for any hint where to look at? Thanks!

Logger: homeassistant.config
Source: config.py:1153
First occurred: 2:26:21 PM (1 occurrence)
Last logged: 2:26:21 PM

Unknown error calling automation config validator - 'condition'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 1153, in async_process_component_config
    await config_validator.async_validate_config(hass, config), []
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/automation/config.py", line 328, in async_validate_config
    await _try_async_validate_config_item(hass, p_config)
  File "/usr/src/homeassistant/homeassistant/components/automation/config.py", line 306, in _try_async_validate_config_item
    return await _async_validate_config_item(hass, config, False, True)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/components/automation/config.py", line 239, in _async_validate_config_item
    automation_config[CONF_CONDITIONS] = await async_validate_conditions_config(
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        hass, validated_config[CONF_CONDITIONS]
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/condition.py", line 1326, in async_validate_conditions_config
    return [await async_validate_condition_config(hass, cond) for cond in conditions]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/condition.py", line 1290, in async_validate_condition_config
    sub_cond = await async_validate_condition_config(hass, sub_cond)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/condition.py", line 1285, in async_validate_condition_config
    condition_key: str = config[CONF_CONDITION]
                         ~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'condition'

Have you written any automations in YAML files rather than the UI? Perhaps check those are up to date with the new syntax:

triggers:
  - trigger:

conditions:
  - condition:

actions:
  - action:

The conditions header used to be condition: — which should still work but looks like it may be causing a problem in your situation.

Thanks I do have a bunch of YAML automations, and most of them are using condition:. Not sure if that’s causing the problem but will bisect and find out what’s wrong.