initiative.sh icon indicating copy to clipboard operation
initiative.sh copied to clipboard

Bug: Panic when creating a thing named "Journal"

Open MikkelPaulson opened this issue 1 year ago • 3 comments

Steps to reproduce:

  1. Open the web inspector it your browser.
  2. Type npc named journal.
  3. Press j.
  4. Bask in the error message panicked at 'internal error: entered unreachable code', core/src/storage/command.rs:367:30

The unreachable!() code should actually be unreachable - the problem is that the parse_input on line 352 is returning multiple results and the if let block is choosing the canonical StorageCommand::Journal result rather than the fuzzy StorageCommand::Load { .. } result, which is what we're actually concerned with at that point.

MikkelPaulson avatar Sep 21 '23 01:09 MikkelPaulson

@alfonsomartinezs If you're interested, this might help to your understanding of the nuances of command parsing.

MikkelPaulson avatar Sep 21 '23 15:09 MikkelPaulson

After some experimentation with this in the browser, I discovered that after creating an NPC named "Journal", you can actually call your journal if you've already used the command, by pressing up and then enter. It's typing "j" in the box that causes the panic.

ThinkerDreamer avatar Aug 15 '24 13:08 ThinkerDreamer

Correct, the panic is in the autocomplete code, not the command parsing. Those are unfortunately two completely different code blocks that do effectively the same thing by way of incomplete vs. complete parsing (#104). Accessing it through the command history will bypass the autocomplete code altogether.

MikkelPaulson avatar Aug 15 '24 15:08 MikkelPaulson