PSReadLine icon indicating copy to clipboard operation
PSReadLine copied to clipboard

Warp error

Open bananaman9 opened this issue 1 year ago • 1 comments

Prerequisites

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

Exception report

-----------------------------------------------------------------------
Last 200 Keys:
 s t W r i t e T i m e Space - D e s c e n d i n g Space | Space S e l e c t - O b j e c t Space - F i r s t Space 1 5 Space F u l l N a m e , Space L a s t W r i t e T i m e Enter
 Enter
 " ` n - - - Space E r r o r s Space ( l a s t Space 8 0 ) Space - - - " Enter
 i f Space ( T e s t - P a t h Space $ E r r ) Space { Space G e t - C o n t e n t Space $ E r r Space - T a i l Space 8 0 Space } Space e l s e Space { Space " N o Space a g e n t - d a e m o n . e r r . t x t Space a t Space $ E r r " Space } Space } Enter
 Alt+1

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.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.AcceptLineImpl(Boolean validate)
   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)
-----------------------------------------------------------------------
. { # Restart the agent daemon and verify it is writing fresh runs
>> $ErrorActionPreference = 'Stop'
>> $Root   = (Resolve-Path ".").Path
>> $PY     = (Test-Path ".\.venv\Scripts\python.exe") ? (Resolve-Path ".\.venv\Scripts\python.exe").Path : "python"
>> $Config = Join-Path $Root "config\symbols.yaml"
>> $LogDir = Join-Path $Root "runs\logs"
>> New-Item -ItemType Directory -Path $LogDir -Force | Out-Null
>> $Out = Join-Path $LogDir "agent-daemon.out.txt"
>> $Err = Join-Path $LogDir "agent-daemon.err.txt"
>> 
>> "--- Stopping existing agent daemons ---"
>> $pids = Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -like "*ai_trader.cli agent daemon*" } | Select-Object -ExpandProperty ProcessId
>> foreach ($pid in $pids) { try { Stop-Process -Id $pid -Force -ErrorAction SilentlyContinue } catch {} }
>> Start-Sleep -Seconds 1
>> 
>> if (-not (Test-Path $Config)) {
>>   Write-Host "Config file not found at $Config" -ForegroundColor Red
>> }
>> 
>> "--- Starting new agent daemon ---"
>> $Arg = "-m ai_trader.cli agent daemon --config `"$Config`" --root `"$Root`" --pop 24 --gens 8 --min-win 0.60 --warm 8 --jitter 5"
>> Start-Process -FilePath $PY -ArgumentList $Arg -WindowStyle Minimized -RedirectStandardOutput $Out -RedirectStandardError $Err
>> "RESTARTED | PY=$PY | LOGS=$Out | $Err"
>> 
>> "--- Waiting for first cycle window ---"
>> Start-Sleep -Seconds 12
>> 
>> "--- Running agent processes ---"
>> Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -like "*ai_trader.cli agent daemon*" } | Select-Object ProcessId, CommandLine
>> 
>> "`n--- Daemon log (last 100 lines) ---"
>> if (Test-Path $Out) { Get-Content $Out -Tail 100 } else { "No agent-daemon.out.txt at $Out" }
>> 
>> "`n--- Recent run snapshots ---"
>> Get-ChildItem (Join-Path $Root "runs") -Filter *.json | Sort-Object LastWriteTime -Descending | Select-Object -First 15 FullName, LastWriteTime
>> 
>> "`n--- Errors (last 80) ---"
>> if (Test-Path $Err) { Get-Content $Err -Tail 80 } else { "No agent-daemon.err.txt at $Err" } }An exception occurred in custom key handler, see $error for more information: Exception calling "BackwardDeleteLine" with "0" argument(s): "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."

Screenshot

The code asked me to post the error here.

Environment data

It was running in Warp ide

Steps to reproduce

. { # Restart the agent daemon and verify it is writing fresh runs

$ErrorActionPreference = 'Stop' $Root = (Resolve-Path ".").Path $PY = (Test-Path "..venv\Scripts\python.exe") ? (Resolve-Path "..venv\Scripts\python.exe").Path : "python" $Config = Join-Path $Root "config\symbols.yaml" $LogDir = Join-Path $Root "runs\logs" New-Item -ItemType Directory -Path $LogDir -Force | Out-Null $Out = Join-Path $LogDir "agent-daemon.out.txt" $Err = Join-Path $LogDir "agent-daemon.err.txt"

"--- Stopping existing agent daemons ---" $pids = Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -like "ai_trader.cli agent daemon" } | Select-Object -ExpandProperty ProcessId foreach ($pid in $pids) { try { Stop-Process -Id $pid -Force -ErrorAction SilentlyContinue } catch {} } Start-Sleep -Seconds 1

if (-not (Test-Path $Config)) { Write-Host "Config file not found at $Config" -ForegroundColor Red }

"--- Starting new agent daemon ---" $Arg = "-m ai_trader.cli agent daemon --config "$Config" --root "$Root" --pop 24 --gens 8 --min-win 0.60 --warm 8 --jitter 5" Start-Process -FilePath $PY -ArgumentList $Arg -WindowStyle Minimized -RedirectStandardOutput $Out -RedirectStandardError $Err "RESTARTED | PY=$PY | LOGS=$Out | $Err"

"--- Waiting for first cycle window ---" Start-Sleep -Seconds 12

"--- Running agent processes ---" Get-CimInstance Win32_Process | Where-Object { $_.CommandLine -like "ai_trader.cli agent daemon" } | Select-Object ProcessId, CommandLine

"`n--- Daemon log (last 100 lines) ---" if (Test-Path $Out) { Get-Content $Out -Tail 100 } else { "No agent-daemon.out.txt at $Out" }

"`n--- Recent run snapshots ---" Get-ChildItem (Join-Path $Root "runs") -Filter *.json | Sort-Object LastWriteTime -Descending | Select-Object -First 15 FullName, LastWriteTime

"`n--- Errors (last 80) ---" if (Test-Path $Err) { Get-Content $Err -Tail 80 } else { "No agent-daemon.err.txt at $Err" } Oops, something went wrong. Please report this bug with the details below. Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new

Expected behavior

to run code cleanly

Actual behavior

Bugged out with the errors above

bananaman9 avatar Sep 29 '25 12:09 bananaman9

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.

github-actions[bot] avatar Sep 29 '25 13:09 github-actions[bot]