Skip to content

[BUG] v2.3.4 regression: enquirer package loses first character on subsequent prompts #30747

@esroyo

Description

@esroyo

Summary

Deno v2.3.4 introduced a regression where the enquirer npm package loses the first character when typing responses to the second and subsequent prompts in a sequence.

Root Cause

Suspected cause: "fix(ext/node): prevent stdin double read (#29353)"

Reproduction

// enquirer_regression.ts
import Enquirer from "npm:enquirer@^2.4.1";

const { prompt } = Enquirer;

console.log("=== Deno v2.3.4 Enquirer Regression Test ===");

const first = await prompt({
  type: 'input',
  name: 'first',
  message: 'First prompt - Type "hello"'
});

const second = await prompt({
  type: 'input', 
  name: 'second',
  message: 'Second prompt - Type "world"'
});

console.log('Results:', first, second);

Run: deno run --allow-read --allow-net enquirer_regression.ts

Expected Behavior

First prompt - Type "hello": hello
Second prompt - Type "world": world
Results: { first: 'hello' } { second: 'world' }

Actual Behavior in v2.3.4

When typing the second prompt response:

  • First character typed disappears
  • User must type each key twice to see characters appear
  • Final result missing first character
First prompt - Type "hello": hello
Second prompt - Type "world": orld
Results: { first: 'hello' } { second: 'orld' }

Environment

  • Working: Deno v2.3.3 and earlier
  • Broken: Deno v2.3.4
  • Package: enquirer@2.4.1
  • Pattern: First prompt works fine, 2nd+ prompts lose first character

Additional Notes

  • Cannot create minimal reproduction: Multiple attempts to reproduce this issue with dependency-free readline/keypress patterns were unsuccessful
  • Issue is library-specific: The bug appears to be a subtle interaction between the v2.3.4 "prevent stdin double read" fix and enquirer's specific stdin/readline implementation patterns
  • Reliable reproduction: While minimal reproductions failed, the enquirer case reliably demonstrates the regression across different environments
  • Potential wider impact: Other prompt libraries using similar readline patterns may be affected

Impact

Breaks interactive CLI applications using enquirer, making them unusable for multi-prompt workflows.

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions