Setup failed for 'automation': Invalid config

I have tried delete all automation and configur a simple automation.There is no any condition in automation, but same error.
automations.yaml

- id: '1751799577633'
  alias: test utelys
  description: ''
  triggers:
  - trigger: sun
    event: sunrise
    offset: 0
  actions:
  - type: turn_off
    device_id: 4aabb60ed6a1fccbd9926d5371f5e53d
    entity_id: 2945dffc61ca85748f25b910d876e35b
    domain: light
  mode: single
Log details (ERROR)
Logger: homeassistant.config
Source: config.py:1156
First occurred: July 5, 2025 at 9:09:01 PM (1 occurrence)
Last logged: July 5, 2025 at 9:09:01 PM

Unknown error calling automation config validator - 'condition'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/config.py", line 1156, 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 260, in _async_validate_config_item
    automation_config[CONF_ACTIONS] = await script.async_validate_actions_config(
                                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        hass, validated_config[CONF_ACTIONS]
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 303, in async_validate_actions_config
    return [await async_validate_action_config(hass, action) for action in actions]
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 348, in async_validate_action_config
    conditions = await condition.async_validate_conditions_config(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        hass, choose_conf[CONF_CONDITIONS]
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/src/homeassistant/homeassistant/helpers/condition.py", line 967, 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 939, in async_validate_condition_config
    condition = config[CONF_CONDITION]
                ~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'condition'

thats a really old automation lol change it to

- id: '1751799577633'
  alias: test utelys
  description: ''
  trigger:
    - platform: sun
      event: sunrise
      offset: "0"
  action:
    - service: light.turn_off
      target:
        entity_id: light.utelys  
  mode: single

You’re the wrong way around. OP’s syntax is the new one.

@smile — are you creating that automation by writing YAML directly into automations.yaml? If so, don’t. See here:

really the use of domain: light in a automation is from 2020 now it light.turn_on

That’s not an old / new problem. The syntax change is from trigger: / platform to triggers: / trigger.

Device triggers and actions, whilst objectively worse in most situations, were introduced more recently than the entity triggers and actions that you are (rightly) suggesting — but I don’t believe that’s the cause of the error here.

Try adding a line:

conditions: []

in his log

Unknown error calling automation config validator - 'condition'

File "/homeassistant/helpers/condition.py", line 939, in async_validate_condition_config
condition = config[CONF_CONDITION]
KeyError: 'condition'

The real cause is your YAML structure had invalid keys, so the automation parser got confused.

triggers:  
  - trigger: sun

to

trigger:
  - platform: sun

and

actions:

to

action:

Again, no you are wrong. The way you are suggesting is still supported but it is the old syntax. See the docs:

OP doesn’t even have a condition: or the newer conditions:. I think the problem is trying to manually edit the system’s own YAML file as per the link in my first post.

I have done that for 7 years.

After make a new automation in UI, pop up error-

 New automation setup failed
Your new automation has saved, but waiting for it to setup has timed out. This could be due to errors parsing your configuration.yaml, please check the configuration in developer tools. Your automation will not be visible until this is corrected, and automations are reloaded. Changes to area, category, or labels were not saved and must be reapplied.

genrated automation in automation.yaml

- id: '1751895614842'
  alias: test utelys
  description: ''
  triggers:
  - trigger: sun
    event: sunrise
    offset: 0
  conditions: []
  actions:
  - type: turn_off
    device_id: 4aabb60ed6a1fccbd9926d5371f5e53d
    entity_id: 2945dffc61ca85748f25b910d876e35b
    domain: light
  mode: single

Configuration.yaml

homeassistant:
  customize: !include customize.yaml
  packages: !include_dir_named packages
  auth_mfa_modules:
  - type: totp
    name: "Authenticator app"
  - type: notify
    message: "HA otp {}"    
# Loads default set of integrations. Do not remove.
  auth_providers:
    - type: trusted_networks
      trusted_networks:
        - 192.168.1.0/24
    - type: homeassistant
default_config:

# Load frontend themes from the themes folder
frontend:
  themes: !include_dir_merge_named themes


automation: !include automations.yaml
input_boolean: !include include/input_boolean.yaml
input_number: !include include/input_number.yaml
input_select: !include include/input_select.yaml
input_text: !include include/input_text.yaml
sensor: !include sensors.yaml
script: !include scripts.yaml
scene: !include scenes.yaml
multiscrape: !include multiscrape.yaml
mqtt: !include mqtt.yaml
zone: !include zones.yaml
group: !include groups.yaml
Installation method - Home Assistant OS
Core - 2025.6.3
Supervisor - 2025.06.2
Operating System - 15.2
Frontend - 20250531.4