Repository navigation
Closed
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Resolution-DuplicateThe issue is a duplicate.The issue is a duplicate.
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
- Install PowerShell 7.6.6.
- Set the terminal/console window to a very narrow width (or launch
pwshin a terminal emulator whose initial column count is very small). - Run
pwsh(or open a new PowerShell 7.6.6 tab in Windows Terminal with the narrow profile). - Observe that PowerShell terminates immediately with the exception below.
Expected behavior
PowerShell should start normally. If the update notification banner cannot fit in the current console width, it should skip rendering the notification or truncate it gracefully, rather than crashing the entire process.Actual behavior
PowerShell crashes at startup with `ArgumentOutOfRangeException` and exits with code `2148734499 (0x80131623)`. The process is terminated before any prompt appears, so the user cannot use the shell to fix the issue.
Stack trace:
totalWidth ('-17') must be a non-negative value. (Parameter 'totalWidth')
Actual value was -17.
at System.ArgumentOutOfRangeException.ThrowNegative[T](T value, String paramName)
at System.String.PadRight(Int32 totalWidth, Char paddingChar)
at Microsoft.PowerShell.UpdatesNotification.ShowUpdateNotification(PSHostUserInterface hostUI)
at Microsoft.PowerShell.ConsoleHost.Start(String bannerText, String helpText, Boolean issProvidedExternally)
at Microsoft.PowerShell.UnmanagedPSEntry.Start(String[] args, Int32 argc)
The `Environment.FailFast` call makes this a hard crash rather than a recoverable error.Error details
Process terminated.
totalWidth ('-17') must be a non-negative value. (Parameter 'totalWidth')
Actual value was -17.
at System.Environment.FailFast(System.Runtime.CompilerServices.StackCrawlMarkHandle, System.String, System.Runtime.CompilerServices.ObjectHandleOnStack, System.String)
at System.Environment.FailFast(System.Threading.StackCrawlMark ByRef, System.String, System.Exception, System.String)
at System.Environment.FailFast(System.String, System.Exception)
at Microsoft.PowerShell.UnmanagedPSEntry.Start(System.String[], Int32)
at Microsoft.PowerShell.ManagedPSEntry.Main(System.String[])Environment data
Name Value
---- -----
PSVersion 7.6.6
PSEdition Core
GitCommitHash (unknown — crashed before startup)
OS Windows (exact build affected)
Platform Win32NT
> **Note:** `$PSVersionTable` cannot be collected from the crashing instance because the process terminates before the prompt loads. The version above is from the installer/package.Visuals
Not applicable.
Reacted by ZW, 挥手的骑士, Kvn Wu, NateScarlet, Salvatore Meschini, David Klingenberg, Alexis Saettler, myTangly, ken2754, Lance.Moe and 3 more
Reacted by Bennett-Yang
Reacted by chen-qian-loveaxi and Jz
Metadata
Metadata
Assignees
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.The issue is new and needs to be triaged by a work group.Resolution-DuplicateThe issue is a duplicate.The issue is a duplicate.
Activity
wlchen1102 commentedon Oct 20, 2026
The console width is not involved in this crash, so the reproduction steps here point in the wrong direction and may mislead triage.
totalWidthin the exception is not the window width. It is the padding width computed from the localized notification template itself inUpdatesNotification.ShowUpdateNotification:There is no read of
Console.WindowWidth/RawUI.WindowSizeanywhere on this path. The value depends only on the line lengths of the localized template and the release tag, so the crash reproduces at any console size - a 200-column window crashes exactly like a 20-column one.For
zh-Hanson 7.6.6 the shipped template gives38 - 58 + 3 = -17, which is why the reported value is-17regardless of the terminal geometry. Locales with a different URL length produce other values (ko-KRreports-23,zh-Hantreports-13).This is the same root cause as #28131, where the analysis and a fix proposal (#28236) already exist. Narrowing the window is not required to reproduce.
windsBoy1 commentedon Oct 20, 2026
PowerShell 7.6.7 no this error ,
ygu8007 commentedon Oct 20, 2026
It seems that the notification of upgrade is the trigger. Because there isn't such bug in Pwsh 7.6.7 after upgrade.
Sorrow-Scarlet commentedon Oct 20, 2026
7.6.6 same issue. But triggered when open a posh window inside
win terminalit poped a msg window and crashed. But inside vscode or codium, the posh 7.6.6 is fine.nandaccio commentedon Oct 20, 2026
Clone of #28131, I would suggest closing this one to avoid adding noise to the resolution.
frogintr commentedon Oct 21, 2026
This is not a console-width issue, and widening the window does not help. The failure comes from the localized resource string.
UpdatesNotification.ShowUpdateNotificationassumes the first line of the message template is the longest:Measured on the shipped 7.6.6 zh-Hans satellite (
Microsoft.PowerShell.ConsoleHost.resources.dll,ManagedEntranceStrings.StableUpdateNotificationMessage):Line 3 is the release URL, so it keeps its length in every locale while line 1 shrinks. With CRLF line endings
IndexOf('\n')yieldsline1Length = 38andline3Length = 58, so the third line computes38 - 58 + 3 = -17— exactly the value in the exception. The en-US template gives60 - 57 + 3 = 6and never fails, which is why this only hits localized users and why the console width is irrelevant.Repro is deterministic: PowerShell 7.6.6 (MSIX, Windows 11) with a zh-Hans UI culture. The notification for v7.6.7 (published 2026-10-13, 7-day delay elapsed on 2026-10-20) fires on every interactive start and takes the shell down through
Environment.FailFast, before any profile runs. Note that v7.6.7 ships a byte-identicalUpdatesNotification.cs, so upgrading does not help either.#28242 removes the feature on master and carries
Backport-7.6.x-Approved, so the next 7.6.x servicing release should clear this. Workaround until then: setPOWERSHELL_UPDATECHECK=Offbefore PowerShell starts.microsoft-github-policy-service commentedon Oct 22, 2026
This issue has been marked as duplicate and has not had any activity for 1 day. It has been closed for housekeeping purposes.
Geekstrange commentedon Oct 29, 2026
PowerShell 7.6.7
Process terminated.
totalWidth ('-17') must be a non-negative value. (Parameter 'totalWidth')
Actual value was -17.
at System.Environment.FailFast(System.Runtime.CompilerServices.StackCrawlMarkHandle, System.String, System.Runtime.CompilerServices.ObjectHandleOnStack, System.String)
at System.Environment.FailFast(System.Threading.StackCrawlMark ByRef, System.String, System.Exception, System.String)
at System.Environment.FailFast(System.String, System.Exception)
at Microsoft.PowerShell.UnmanagedPSEntry.Start(System.String[], Int32)
at Microsoft.PowerShell.ManagedPSEntry.Main(System.String[])
System.ArgumentOutOfRangeException: totalWidth ('-17') must be a non-negative value. (Parameter 'totalWidth')
Actual value was -17.
at System.ArgumentOutOfRangeException.ThrowNegative[T](T value, String paramName)
at System.String.PadRight(Int32 totalWidth, Char paddingChar)
at Microsoft.PowerShell.UpdatesNotification.ShowUpdateNotification(PSHostUserInterface hostUI)
at Microsoft.PowerShell.ConsoleHost.Start(String bannerText, String helpText, Boolean issProvidedExternally)
at Microsoft.PowerShell.UnmanagedPSEntry.Start(String[] args, Int32 argc)
kilasuit commentedon Oct 29, 2026
Geekstrange (@Geekstrange) - Please update to the latest v7.6.9 release
The Update Notification Feature, which was causing this crash was removed as part of the v7.6.8 release so you won't get this happen in future.