Skip to content

PSReadLine crashes with ArgumentOutOfRangeException in ReallyRender (top = -5) #5241

Closed

Description

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.

Exception report

Last 200 Keys:

 p a s t e d :   b y   l o o k i n g   t h r o u g h   p r e v i o u s   o u t p u t

Exception:
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
Parameter name: top
Actual value was -5.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.Internal.VirtualTerminal.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.AcceptLineImpl(Boolean validate)
   at Microsoft.PowerShell.PSConsoleReadLine.AcceptLine(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics)

Screenshot

pweshell-buh

Environment data

PS Version: 5.1.19041.7844
PS HostName: ConsoleHost (Windows Terminal)
PSReadLine Version: 2.0.0-beta2
PSReadLine EditMode: Windows
OS: 10.0.19041.320 (WinBuild.160101.0800)
BufferWidth: 209
BufferHeight: 52

Steps to reproduce

  1. Open Windows PowerShell with PSReadLine enabled.
  2. Execute a long PowerShell script that generates substantial console output.
  3. Continue interacting with the console and entering commands.
  4. PSReadLine eventually throws an ArgumentOutOfRangeException during rendering.

I have not yet identified a minimal reproducible example.

Expected behavior

`PSReadLine crashs with an ArgumentOutOfRangeExcepton and displays the "Oops, somethi*g went wrong" error screen.

The eception is thrown from Console.SetursorPosition during PSReadLine re*dering:

System.ArgumentOutOfRangexception: The value must be greate than or equal to zero and less thn the console's buffer size in tha dimension.
Parameter name: top
Ac*ual value was -5

After the excepton, normal PSReadLine command-lineediting is interrupted.`

Actual behavior

PSReadLine crashed with an ArgumentOutOfRangeException and displayed the error screen. The exception occurred in Console.SetCursorPosition during PSReadLine rendering, with the parameter 'top' having a value of -5. Normal command-line editing was interrupted after the exception was thrown.

Activity

  1. added
    Needs-Triage 🔍
    on Nov 23, 2026
  2. github-actions commented on Nov 23, 2026

    @github-actions

    This issue was already fixed (see #1306). Please upgrade to the 2.3.5 version of PSReadLine from PowerShell Gallery.
    See the upgrading section for instructions. Please let us know if you run into the same issue with the latest version.

  3. removed
    Needs-Triage 🔍
    on Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions