Node repl crashes when trying to call back a large multiline item
Open
Nobody has claimed this yet.
confirmed-bug
readline
repl
- Dominant language
- JavaScript
- Stars
- 122k
- Forks
- 37.3k
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 283
Description
Version
24.4.1
Platform
Linux panta-rog 6.14.0-27-generic #27-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 17:01:58 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Subsystem
No response
What steps will reproduce the bug?
Paste a huge multi-line JSON into repl.
Then bring it back via arrow up.
Then press arrow up again.
How often does it reproduce? Is there a required condition?
I can reproduce it with a long JSON.
What is the expected behavior? Why is that the expected behavior?
No crash.
What do you see instead?
TypeError: Cannot read properties of undefined (reading 'length')
at REPLServer.[_multilineMove] (node:internal/readline/interface:1092:36)
at REPLServer.[_moveUpOrHistoryPrev] (node:internal/readline/interface:1149:27)
at REPLServer.[_ttyWrite] [as _ttyWrite] (node:internal/readline/interface:1498:37)
at REPLServer.self._ttyWrite (node:repl:1035:9)
at ReadStream.onkeypress (node:internal/readline/interface:284:20)
at ReadStream.emit (node:events:507:28)
at ReadStream.emit (node:domain:489:12)
at emitKeys (node:internal/readline/utils:371:14)
at emitKeys.next (<anonymous>)
at ReadStream.onData (node:internal/readline/emitKeypressEvents:64:36)
Additional information
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the crash in the Node REPL with a large multiline JSON item, then inspect internal/readline/interface at _multilineMove and _moveUpOrHistoryPrev, along with node:repl. Done means repeating the two arrow-up actions does not throw the reported TypeError or crash the REPL.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, linux, node.js
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100