Template error: (See ?, line ?)

Since a while back I’m getting this cryptic error, how can I figure out where it comes from?

Invalid config for [automation]: template value should be a string for dictionary value @ data['action'][1]['data_template']. Got None. (See ?, line ?).

The second action of one of your automations is misconfigured. The action is using a data_template that isn’t returning any valid value where the service call expects a string.

My guess is that you have an if template without an else case.