# Im getting a return code error but command runs but it shows up as failed please help!

**URL:** <https://forum.ansible.com/t/im-getting-a-return-code-error-but-command-runs-but-it-shows-up-as-failed-please-help/37637>\
**Category:** Ansible Project\
**Created:** [February 9, 2023, 12:50am UTC](https://forum.ansible.com/t/im-getting-a-return-code-error-but-command-runs-but-it-shows-up-as-failed-please-help/37637 "2023-02-09T00:50:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jay\_Kumar](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@Jay\_Kumar](https://forum.ansible.com/u/Jay_Kumar)\
**Post date:** [February 9, 2023, 12:50am UTC](https://forum.ansible.com/t/im-getting-a-return-code-error-but-command-runs-but-it-shows-up-as-failed-please-help/37637/1 "2023-02-09T00:50:58Z")

</div>

![pic (2).png](https://us1.discourse-cdn.com/ansible/original/2X/2/26b1a45f6b18cf87a35414c53cb9cfc6bd4f0680.jpeg)

I’m getting a return code of 3, my shell module runs and the output is what im expecting but it still shows up as failed, here is an image of it. I also do not want to use ignore\_error for this.

Thank you in advance,

---

<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:** [February 9, 2023, 6:27am UTC](https://forum.ansible.com/t/im-getting-a-return-code-error-but-command-runs-but-it-shows-up-as-failed-please-help/37637/2 "2023-02-09T06:27:21Z")

</div>

Please copy and paste the text, and do not post screens caps.

> **(attachments)**
>
> ![pic (2).jpg](https://us1.discourse-cdn.com/ansible/original/2X/2/26b1a45f6b18cf87a35414c53cb9cfc6bd4f0680.jpeg)

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [February 9, 2023, 2:52pm UTC](https://forum.ansible.com/t/im-getting-a-return-code-error-but-command-runs-but-it-shows-up-as-failed-please-help/37637/3 "2023-02-09T14:52:13Z")

</div>

You said it yourself: “I’m getting a return code of 3”.  
The shell module will set `failed: true` if the script’s rc is not 0.

---

<div class="post-metadata">

**Author:** ![Jay\_Kumar](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@Jay\_Kumar](https://forum.ansible.com/u/Jay_Kumar)\
**Post date:** [February 9, 2023, 9:51pm UTC](https://forum.ansible.com/t/im-getting-a-return-code-error-but-command-runs-but-it-shows-up-as-failed-please-help/37637/4 "2023-02-09T21:51:13Z")

</div>

I was able to fix it with a failed when: var.stderr | count \> 0
