Homeassistant question about complex debugging (configuration and integrations)

Hi there,
Now, for more than three months, I’ve started to move my home automation system to HomeAssistant. Every day I learn a lot of things and it is pleasant to find most answer within the community or in the HA documentation.

However, there is one thing that is really annoying, and for what I struggle to find answers : the inability to have precise error stack trace.

As my “configuration.yaml” has been splitting with multiples include directives, my error logs often ends up with an error simply referencing my !include line within my configuration.yaml.

for example in a basic automation:
Invalid config for [automation]: Service {% if trigger.to_state = "on" %} light.turn_on {% else %} light.turn_off {% endif %} does not match format <domain>.<name> for dictionary value @ data['action'][0]['service']. Got None. (See /config/configuration.yaml, line 22).

which is simply referencing :
/configuration.yaml, line 22 = automation: !include_dir_merge_list includes/automations

I’m a bit surprised, because of the nature of the yaml “language” I guess the core system is using parsers to walk-through all descriptions/directives, and should be able exactly know from where come the error, and be able to trace back the stack from the error to the entry point.

Or when an internal component raise an error, most of the time we don’t know what is the starting point… yes there is a trace-back on the module itself, but we don’t know which service is originating the call to that component that ends up with an error.

for example in Ingress error help the error appears randomly but we don’t know why and the most important which is the service that is calling this component in order to correct the source of the issue.

So, maybe I’ve been missing something, therefore my questions are :

  1. how to proceed to efficiently “debug” complex configuration;
  2. is there a way to get more trace to identify the source call.

By your-side, how are you dealing with complex debugging?

Many thanks in advance for your help.