Skip to content

Node repl crashes when trying to call back a large multiline item #59431

@panta82

Description

@panta82

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-bugIssues with confirmed bugs.replIssues and PRs related to the REPL subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions