# Handle invalid commands

**URL:** <https://forum.codecrafters.io/t/handle-invalid-commands/15512>\
**Category:** Challenges\
**Tags:** challenge:shell\
**Created:** [November 10, 2025, 4:15pm UTC](https://forum.codecrafters.io/t/handle-invalid-commands/15512 "2025-11-10T16:15:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![LivLah](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/livlah/32/19778_2.png) [@LivLah](https://forum.codecrafters.io/u/LivLah)\
**Post date:** [November 10, 2025, 4:15pm UTC](https://forum.codecrafters.io/t/handle-invalid-commands/15512/1 "2025-11-10T16:15:12Z")

</div>

```javascript
const readline = require("readline");

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout,
});

rl.question('$ ', (command) => {
  console.log(`${command}: command not found`);
  rl.close();
});

```

What is wrong with my code? It’s not passing to the next stage

---

<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:** [November 11, 2025, 6:56am UTC](https://forum.codecrafters.io/t/handle-invalid-commands/15512/4 "2025-11-11T06:56:57Z")

</div>

Hey @LivLah, the code looks correct, but it might not have been saved or committed.

Could you share a screenshot of the code as shown in your editor so we can double-check?

---

<div class="post-metadata">

**Author:** ![LivLah](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/livlah/32/19778_2.png) [@LivLah](https://forum.codecrafters.io/u/LivLah)\
**Post date:** [November 11, 2025, 9:12am UTC](https://forum.codecrafters.io/t/handle-invalid-commands/15512/6 "2025-11-11T09:12:29Z")

</div>

![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/2/f/2f9e242154739c8050e943183af0df0857615459.jpeg)

---

<div class="post-metadata">

**Author:** ![LivLah](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/livlah/32/19778_2.png) [@LivLah](https://forum.codecrafters.io/u/LivLah)\
**Post date:** [November 11, 2025, 9:13am UTC](https://forum.codecrafters.io/t/handle-invalid-commands/15512/7 "2025-11-11T09:13:19Z")

</div>

Oh I passed the test. I tried to commit through the Vs code terminal and it worked!

---

<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:** [November 11, 2025, 9:18am UTC](https://forum.codecrafters.io/t/handle-invalid-commands/15512/8 "2025-11-11T09:18:35Z")

</div>

Just FYI, these indicate that the file has been modified but not yet committed.

 ![image](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/d/7d759a4cd1d01a2e1cc85bea037e1731740d02a8.jpeg)

---

<div class="post-metadata">

**Author:** ![LivLah](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/livlah/32/19778_2.png) [@LivLah](https://forum.codecrafters.io/u/LivLah)\
**Post date:** [November 11, 2025, 10:13am UTC](https://forum.codecrafters.io/t/handle-invalid-commands/15512/9 "2025-11-11T10:13:57Z")

</div>

Oh I see! Thank you so much, I’ll bear this in mind

---

<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:** [November 16, 2025, 10:14am UTC](https://forum.codecrafters.io/t/handle-invalid-commands/15512/10 "2025-11-16T10:14:13Z")

</div>

Closed on November 16, 2025, 10:14am UTC

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