# Error: The requested handler was not found

**URL:** <https://forum.ansible.com/t/error-the-requested-handler-was-not-found/26043>\
**Category:** Ansible Project\
**Created:** [November 16, 2017, 10:48am UTC](https://forum.ansible.com/t/error-the-requested-handler-was-not-found/26043 "2017-11-16T10:48:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shlomit\_Afgin](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@Shlomit\_Afgin](https://forum.ansible.com/u/Shlomit_Afgin)\
**Post date:** [November 16, 2017, 10:48am UTC](https://forum.ansible.com/t/error-the-requested-handler-was-not-found/26043/1 "2017-11-16T10:48:27Z")

</div>

I have ansible 2.5. the ymal file have:

> - name: Make sure file1.conf update
> 
> copy:
> 
> src: file1.conf
> 
> dest: /tmp/file1.conf
> 
> tags: copy-file1
> 
> notify:
> 
> - cat file1
> 
> handlers:
> 
> - name: cat file1
> 
> command: cat /tmp/file1.conf \> /tmp/dates

when I run ansible-playbook I get:

> ERROR! The requested handler ‘cat file1’ was not found in either the main handlers list nor in the listening handlers list

Any ideas?  
Thanks

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [November 16, 2017, 10:58am UTC](https://forum.ansible.com/t/error-the-requested-handler-was-not-found/26043/2 "2017-11-16T10:58:26Z")

</div>

> I have ansible 2.5. the ymal file have:
> 
> - name: Make sure file1.conf update  
> &nbsp;&nbsp;copy:  
> &nbsp;&nbsp;&nbsp;&nbsp;src: file1.conf  
> &nbsp;&nbsp;&nbsp;&nbsp;dest: /tmp/file1.conf  
> &nbsp;&nbsp;tags: copy-file1  
> &nbsp;&nbsp;notify:  
> &nbsp;&nbsp;- cat file1
> 
> &nbsp;&nbsp;handlers:  
> &nbsp;&nbsp;&nbsp;&nbsp;- name: cat file1  
> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;command: cat /tmp/file1.conf \> /tmp/dates

Is this the complete file? Is it a playbook?  
If so, you are missing a lot of things.

> when I run ansible-playbook I get:
> 
> ERROR! The requested handler 'cat file1' was not found in either the main  
> handlers list nor in the listening handlers list

You handlers: is indented incorrect, it should be at the same level as the tasks:

---

<div class="post-metadata">

**Author:** ![Shlomit\_Afgin](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@Shlomit\_Afgin](https://forum.ansible.com/u/Shlomit_Afgin)\
**Post date:** [November 16, 2017, 2:03pm UTC](https://forum.ansible.com/t/error-the-requested-handler-was-not-found/26043/3 "2017-11-16T14:03:18Z")

</div>

The file contain this yml lines is roles/basic/tasks/main.yml. (start with —)I run it with command: ‘ansible-playbook site.yml’  
In site.yml it’s have:

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [November 16, 2017, 2:13pm UTC](https://forum.ansible.com/t/error-the-requested-handler-was-not-found/26043/4 "2017-11-16T14:13:32Z")

</div>

When you are using roles, handlers goes in a separate directory called handles.  
So you need to move your handler to roles/basic/handlers/main.yml.

---

<div class="post-metadata">

**Author:** ![Shlomit\_Afgin](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@Shlomit\_Afgin](https://forum.ansible.com/u/Shlomit_Afgin)\
**Post date:** [November 16, 2017, 2:18pm UTC](https://forum.ansible.com/t/error-the-requested-handler-was-not-found/26043/5 "2017-11-16T14:18:12Z")

</div>

Thanks a lot! Your questions help me solve the problem.

**The solution** is to move the handler part to roles/basic/handlers/main.yml  
without the ‘handlers:’ label.

Thanks again
