Weird Stacktrace on Ansible Playbook Execution

I’m getting a pretty cryptic stack trace from the latest Ansible built from src (like 10 mins ago):

Traceback (most recent call last):
File “/usr/local/share/python/ansible-playbook”, line 268, in
sys.exit(main(sys.argv[1:]))
File “/usr/local/share/python/ansible-playbook”, line 208, in main
pb.run()
File “/usr/local/lib/python2.7/site-packages/ansible/playbook/init.py”, line 228, in run
play = Play(self, play_ds, play_basedir)
File “/usr/local/lib/python2.7/site-packages/ansible/playbook/play.py”, line 80, in init
ds = self._load_roles(self.roles, ds)
File “/usr/local/lib/python2.7/site-packages/ansible/playbook/play.py”, line 288, in _load_roles
roles = self._build_role_dependencies(roles, , self.vars)
File “/usr/local/lib/python2.7/site-packages/ansible/playbook/play.py”, line 178, in _build_role_dependencies
defaults_data = utils.parse_yaml_from_file(defaults)
File “/usr/local/lib/python2.7/site-packages/ansible/utils/init.py”, line 419, in parse_yaml_from_file
process_yaml_error(exc, data, path)
File “/usr/local/lib/python2.7/site-packages/ansible/utils/init.py”, line 397, in process_yaml_error
msg = process_common_errors(msg, probline, mark.column)
File “/usr/local/lib/python2.7/site-packages/ansible/utils/init.py”, line 358, in process_common_errors
elif len(probline) and probline[column] == “:” and probline.find(“=”) != -1:
IndexError: string index out of range

Where should I start debugging this? I guess there’s a YAML problem here, but it’s pretty cryptic. I suppose I’ll go through my YAML and attempt to self-parse.

This was new code recently introduced to help highlight common errors. I’m guessing that the “column” value may not be zero-indexed, so when the error occurs at the end of the line it may be exceeding the string length. Could you open a github issue for this, and I’ll get you a patch ASAP?

If you’re comfortable editing the code yourself, you might want to change that one line to “column-1” to see if that resolves the issue. The file is lib/ansible/utils/init.py.

Yes, I’ll open an issue at some point today.

I discovered the problem: in one of my variable files I had the following:

varname value

As opposed to

varname: value

Fixing the typo fixed the playbook. Regardless, probably shouldn’t be a stack trace there so I’ll open the issue.

Thanks, this is definitely something I introduced on devel.

If you can share a playbook that triggers it in the github, it will be easy to fix.