The code and YAML file as given should not yield the error you show. Make sure the YAML is correctly formatted (indentation may haven gotten wrong when pasting). Also, please create a
MVCE so that it is obvious what you are asking about. This usually also helps you understanding the problem better. Right now, this looks more like a request for a code review than an inquiry about a specific problem. —
flyx just now