# FAILED! =\> {"msg": "The conditional check .. Unable to look up a name or access an attribute in template string

**URL:** <https://forum.ansible.com/t/failed-msg-the-conditional-check-unable-to-look-up-a-name-or-access-an-attribute-in-template-string/29921>\
**Category:** Ansible Project\
**Created:** [March 20, 2019, 1:39pm UTC](https://forum.ansible.com/t/failed-msg-the-conditional-check-unable-to-look-up-a-name-or-access-an-attribute-in-template-string/29921 "2019-03-20T13:39:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spideyx](https://avatars.discourse-cdn.com/v4/letter/s/848f3c/32.png) [@Spideyx](https://forum.ansible.com/u/Spideyx)\
**Post date:** [March 20, 2019, 1:39pm UTC](https://forum.ansible.com/t/failed-msg-the-conditional-check-unable-to-look-up-a-name-or-access-an-attribute-in-template-string/29921/1 "2019-03-20T13:39:55Z")

</div>

Need Ansible help on error. Same ansible module/task getting error in 1 environment and completely fine in another. Dunno what the causes are. Here’s the error:

fatal: [[hostname.com](http://hostname.com)]: FAILED! =\> {“msg”: “The conditional check ‘‘failed’ in prereq.stdout\_lines’ failed. The error was: error while evaluating conditional (‘failed’ in prereq.stdout\_lines): Unable to look up a name or access an attribute in template string ({% if ‘failed’ in prereq.stdout\_lines %} True {% else %} False {% endif %}).\nMake sure your variable name does not contain invalid characters like ‘-’: argument of type ‘StrictUndefined’ is not iterable”}

here’s task snippet:

- name: Check for patch conflicts

shell: ./patch\_command {{ patch\_directory }}/{{ patchid }}

environment: “{{ env }}”

args:

chdir: “{{ patch\_directory }}”

when: patchid != ‘nopatch’

register: prereq

failed\_when: “‘failed’ in prereq.stdout\_lines”
