# include error message misleading

**URL:** <https://forum.ansible.com/t/include-error-message-misleading/15599>\
**Category:** Ansible Project\
**Created:** [July 3, 2014, 3:23pm UTC](https://forum.ansible.com/t/include-error-message-misleading/15599 "2014-07-03T15:23:11Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tom\_Ekberg](https://avatars.discourse-cdn.com/v4/letter/t/919ad9/32.png) [@Tom\_Ekberg](https://forum.ansible.com/u/Tom_Ekberg)\
**Post date:** [July 3, 2014, 3:23pm UTC](https://forum.ansible.com/t/include-error-message-misleading/15599/1 "2014-07-03T15:23:11Z")

</div>

I distilled the problem down to a simple YAML file:

`

- hosts: apps2

vars:  
TOP\_BAD: “…”

tasks:

- name: check TOP  
debug: msg=“{{TOP}}”

handlers:

- include: “{{TOP}}/handlers/apache\_graceful.yml”

`

When I save this in inc.yml and run this command:

`ansible-playbook -i ../hosts inc.yml`

I get this output:

`ERROR: file could not read: /home/tekberg/src/ansible_scripts/provision_apps2/{{TOP}}/handlers/apache_graceful.yml`

The actual problem is that the variable TOP is not defined, which should have been detected prior to trying to open the file. If I change TOP\_BAD to TOP, the script runs to completion with no errors.

Why didn’t the interpolation code complain that TOP was undefined?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [July 3, 2014, 8:01pm UTC](https://forum.ansible.com/t/include-error-message-misleading/15599/2 "2014-07-03T20:01:02Z")

</div>

“Why didn’t the interpolation code complain that TOP was undefined?”

Because we developers are horrible terrible people that want to cause you pain.

I would ask what version of Ansible you are using and if undefined variable detection is turned on. If on, I would expect this to result in an error, and if not, filing a github ticket would be a good thing.

Thanks!
