Failed to Combine Variables, ‘AnsibleUnicode’Error!

I was trying to connect to juniper os from ansible controller and wanted to move the ansible variables from hosts files to a separate file called junos.yml in group_vars folder. Before this change, my playbooks were running fine but suddenly I got an error message.

ERROR! failed to combine variables, expected dicts but got a 'dict' and a 'AnsibleUnicode'

I spent quite a lot of time searching for a solution and went down some (yes! some!) rabbit holes and wasted 2/3 hours of my time.

The solution that I came up with is that I looked into the group_vars directory files. One of the files were not properly formated as YAML file. So I formatted it into proper YAML format and deleted all other files that are not YAML.

Voila!! It works just as same as before and now I have a better directory structure.

Enjoy!