Repository navigation
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
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: 52Steps to reproduce
- Open Windows PowerShell with PSReadLine enabled.
- Execute a long PowerShell script that generates substantial console output.
- Continue interacting with the console and entering commands.
- 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
github-actions commentedon Nov 23, 2026
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.