# The lookup pipe is returning a 127 error, even though the file exists and has all the required permissions.

**URL:** <https://forum.ansible.com/t/the-lookup-pipe-is-returning-a-127-error-even-though-the-file-exists-and-has-all-the-required-permissions/37984>\
**Category:** Ansible Project\
**Created:** [May 15, 2023, 1:40pm UTC](https://forum.ansible.com/t/the-lookup-pipe-is-returning-a-127-error-even-though-the-file-exists-and-has-all-the-required-permissions/37984 "2023-05-15T13:40:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![LT1](https://avatars.discourse-cdn.com/v4/letter/l/5f8ce5/32.png) [@LT1](https://forum.ansible.com/u/LT1)\
**Post date:** [May 15, 2023, 1:40pm UTC](https://forum.ansible.com/t/the-lookup-pipe-is-returning-a-127-error-even-though-the-file-exists-and-has-all-the-required-permissions/37984/1 "2023-05-15T13:40:30Z")

</div>

I am trying to retrieve the version number of the installed executable. The complete path exists, the file has executable permissions, but I am encountering a 127 error, indicating that the file does not exist. Have I missed something?  
**Here is the code that I have:**

- set\_fact: remote\_version: “{{ lookup(‘ansible.builtin.pipe’, ‘/home/’ + username + ‘/program/executable\_file’ + ’ --version’) }}”

**The error that I am getting:**  
fatal: [xxx.yyy.zzz.fff]: FAILED! =\> {“msg”: “An unhandled exception occurred while running the lookup plugin ‘ansible.builtin.pipe’. Error was a \<class ‘ansible.errors.AnsibleError’\>, original message: lookup\_plugin.pipe(/home/BreadPitt/program/executable --version) returned 127. lookup\_plugin.pipe( /home/BreadPitt/program/executable --version) returned 127”}

---

<div class="post-metadata">

**Author:** ![Walter\_Rowe](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/walter_rowe/32/4506_2.png) [@Walter\_Rowe](https://forum.ansible.com/u/Walter_Rowe)\
**Post date:** [May 15, 2023, 1:47pm UTC](https://forum.ansible.com/t/the-lookup-pipe-is-returning-a-127-error-even-though-the-file-exists-and-has-all-the-required-permissions/37984/2 "2023-05-15T13:47:05Z")

</div>

My guess is that pipe is trying to run an executable named exactly this: “/home/BreadPitt/program/executable --version” vs passing the --version option to the executable.

Walter

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [May 15, 2023, 1:47pm UTC](https://forum.ansible.com/t/the-lookup-pipe-is-returning-a-127-error-even-though-the-file-exists-and-has-all-the-required-permissions/37984/3 "2023-05-15T13:47:05Z")

</div>

Probably because the pipe lookup executes on the ansible controller,  
not on the controlled node:  
[https://docs.ansible.com/ansible/latest/collections/ansible/builtin/pipe\_lookup.html#notes](https://docs.ansible.com/ansible/latest/collections/ansible/builtin/pipe_lookup.html#notes)

---

<div class="post-metadata">

**Author:** ![LT1](https://avatars.discourse-cdn.com/v4/letter/l/5f8ce5/32.png) [@LT1](https://forum.ansible.com/u/LT1)\
**Post date:** [May 15, 2023, 4:15pm UTC](https://forum.ansible.com/t/the-lookup-pipe-is-returning-a-127-error-even-though-the-file-exists-and-has-all-the-required-permissions/37984/4 "2023-05-15T16:15:32Z")

</div>

What is the correct way to use the lookup pipe filter on the remote host?

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [May 15, 2023, 4:45pm UTC](https://forum.ansible.com/t/the-lookup-pipe-is-returning-a-127-error-even-though-the-file-exists-and-has-all-the-required-permissions/37984/5 "2023-05-15T16:45:24Z")

</div>

You don’t, you use the command or shell modules, and register the result, potentially manipulating the result into the shape you want with a subsequent `set_fact` task.

---

<div class="post-metadata">

**Author:** ![LT1](https://avatars.discourse-cdn.com/v4/letter/l/5f8ce5/32.png) [@LT1](https://forum.ansible.com/u/LT1)\
**Post date:** [May 16, 2023, 2:05am UTC](https://forum.ansible.com/t/the-lookup-pipe-is-returning-a-127-error-even-though-the-file-exists-and-has-all-the-required-permissions/37984/6 "2023-05-16T02:05:33Z")

</div>

Thank you for clarification.
