ESP-Home: Why does the yaml have to be correct to listen the logs of a device?

This is just a fabricated error but the same principle applies.

Lets say you are editing in your yaml file and need to listen to the logs. You save the yaml (don’t install) and then press the logs and you get this:

image

Why is the yaml even read? Shouldn’t it just listen to the logs?
When I’m adding/reorganizing things in the yaml I sometimes add stuff that needs to go in to the code at some point, for instance I copy the logs of IR receive and want to integrate them as IR transmit, so I just copy the full lines from the debug window in to the yaml.
I forgot one button, save and open the logs, it doesn’t work because I temporary added the log output in the yaml.

Why does it need to read the yaml in order to get the logs/debug of a device?