# \#QP2 submission failing because of a #UN3 failure

**URL:** <https://forum.codecrafters.io/t/qp2-submission-failing-because-of-a-un3-failure/16186>\
**Category:** Challenges\
**Tags:** challenge:shell\
**Created:** [June 28, 2026, 9:51am UTC](https://forum.codecrafters.io/t/qp2-submission-failing-because-of-a-un3-failure/16186 "2026-06-28T09:51:47Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![aniketpt](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/aniketpt/32/27033_2.png) [@aniketpt](https://forum.codecrafters.io/u/aniketpt)\
**Post date:** [June 28, 2026, 9:51am UTC](https://forum.codecrafters.io/t/qp2-submission-failing-because-of-a-un3-failure/16186/1 "2026-06-28T09:51:47Z")

</div>

When I submitted my solution for stage #QP2, it passed the tests for the target stage, but failed for stage #UN3 (a stage from previous section). My code already passed that stage, so I am trying to understand why its failing the test now.

```auto
[tester::#QP2] Running tests for Stage #QP2 (Command Completion - Builtin completion)
[tester::#QP2] Running ./your_program.sh
[tester::#QP2] ✓ Received prompt ($ )
[tester::#QP2] Typed "ech"
[tester::#QP2] ✓ Prompt line matches "$ ech"
[tester::#QP2] Pressed "<TAB>" (expecting autocomplete to "echo" followed by a space)
[tester::#QP2] ✓ Prompt line matches "echo "
[your-program] $ echo 
[tester::#QP2] Tearing down shell
[tester::#QP2] Running ./your_program.sh
[tester::#QP2] ✓ Received prompt ($ )
[tester::#QP2] Typed "exi"
[tester::#QP2] ✓ Prompt line matches "$ exi"
[tester::#QP2] Pressed "<TAB>" (expecting autocomplete to "exit" followed by a space)
[tester::#QP2] ✓ Prompt line matches "exit "
[your-program] $ exit 
[tester::#QP2] Tearing down shell
[tester::#QP2] Test passed.

[tester::#UN3] Running tests for Stage #UN3 (Redirection - Append stderr)
[tester::#UN3] [setup] export PATH=/tmp/strawberry/strawberry/banana:$PATH
[tester::#UN3] Running ./your_program.sh
[your-program] $ ls -1 nonexistent >> /tmp/pig/bee.md
[tester::#UN3] Didn't find expected line.
[tester::#UN3] Expected: "ls: nonexistent: No such file or directory"
[tester::#UN3] Received: "" (no line received)
[tester::#UN3] Test failed

```

The test is using `>>`, but I think it should have used `2>>` instead. Please let me know in case I am wrong here.

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [June 28, 2026, 4:13pm UTC](https://forum.codecrafters.io/t/qp2-submission-failing-because-of-a-un3-failure/16186/3 "2026-06-28T16:13:02Z")

</div>

Hey @aniketpt, could you [upload your code to GitHub](https://docs.codecrafters.io/features/publish-to-github) and share the link? It will be much easier to debug if I can run it directly.

---

<div class="post-metadata">

**Author:** ![aniketpt](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/aniketpt/32/27033_2.png) [@aniketpt](https://forum.codecrafters.io/u/aniketpt)\
**Post date:** [June 28, 2026, 4:43pm UTC](https://forum.codecrafters.io/t/qp2-submission-failing-because-of-a-un3-failure/16186/4 "2026-06-28T16:43:51Z")

</div>

Sure, please check here - [GitHub - aniketpt/codecrafters-shell-go · GitHub](https://github.com/aniketpt/codecrafters-shell-go)

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [June 28, 2026, 4:47pm UTC](https://forum.codecrafters.io/t/qp2-submission-failing-because-of-a-un3-failure/16186/5 "2026-06-28T16:47:45Z")

</div>

@aniketpt Looks like your code is no longer passing the second stage **#CZ2 (Handle invalid commands)**.

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/f/5/f56b87199096ebf86187cf17f70900d9113dd64a.png)

**Suggestions** :

1. Use [our CLI](https://docs.codecrafters.io/cli/installation) to test against previous stages by running:

```auto
codecrafters test --previous

```

1. Focus on fixing the early stages first, as later stages depend on them.

---

<div class="post-metadata">

**Author:** ![aniketpt](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/aniketpt/32/27033_2.png) [@aniketpt](https://forum.codecrafters.io/u/aniketpt)\
**Post date:** [June 28, 2026, 5:34pm UTC](https://forum.codecrafters.io/t/qp2-submission-failing-because-of-a-un3-failure/16186/6 "2026-06-28T17:34:14Z")

</div>

I see, thank you for pointing me in the right direction. My changes in i/o layer must have broken older functionalities (at least for the online judge).

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [June 28, 2026, 5:42pm UTC](https://forum.codecrafters.io/t/qp2-submission-failing-because-of-a-un3-failure/16186/7 "2026-06-28T17:42:29Z")

</div>

Could you give this a try and see if it resolves the error?

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/a/e/ae8f39e852bace4606219988177c9872aff5f8a4.png)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [July 3, 2026, 5:43pm UTC](https://forum.codecrafters.io/t/qp2-submission-failing-because-of-a-un3-failure/16186/8 "2026-07-03T17:43:25Z")

</div>

Closed on July 3, 2026, 5:43pm UTC

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
