#339·enquirer

Skipping multiple select throws an exception

Author: KerrubaCreated Feb 24, 2021Updated Oct 12, 2024

I've found a bug that happens when you try to skip a multiple-select prompts.

The problem happens here: https://github.com/enquirer/enquirer/blob/8d626c206733420637660ac7c2098d7de45e8590/lib/types/array.js#L508

When the prompt has to be skipped, the this.state._choices is not initialized and choices is therefore undefined. on line 509, the filter function throws an exception which cause an UnhandledPrompiseException error

Here the stack-trace I've copied while debugging the issue

filter(), array.js:506
get enabled(), array.js:620
get selected(), array.js:636
submit(), array.js:546
anonymous(), prompt.js:234
processTicksAndRejections(), task_queues.js:97
Async call from async function
anonymous(), prompt.js:232
run(), prompt.js:229
ask(), index.js:137
prompt(), index.js:82