Skip to content

[Bug] PowerShell 7.6.6 crashes on startup in zh-CN with ArgumentOutOfRangeException: totalWidth ('-17') must be a non-negative value #28302

Closed as duplicate

Description

@jmeng111

Prerequisites

Steps to reproduce

  1. Install PowerShell 7.6.6 on a Windows system with zh-CN (Simplified Chinese) locale.
  2. Open Windows Terminal or conhost.
  3. Run pwsh.exe.
  4. PowerShell crashes immediately.

Expected behavior

PowerShell 7.6.6 should start normally and display an interactive prompt (e.g., `PS C:\>`), allowing me to execute commands without crashing.

Actual behavior

PowerShell terminates immediately on startup before showing any prompt. The process crashes with an `ArgumentOutOfRangeException` because `String.PadRight` is called with a negative width of -17 during the update notification display. The terminal closes instantly, making it impossible to execute any commands like `2 + 2`.

Error details

The process fails fast during initialization. Here is the full console output:

PowerShell 7.6.6
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, Microsoft.Win32.SafeHandles.ObjectHandleOnStack, System.String)
   at System.Environment.FailFast(System.Threading.StackCrawlMark ByRef, System.String, System.Exception, String)
   at System.Environment.FailFast(String, Exception)
   at Microsoft.PowerShell.UnmanagedPSEntry.Start(String[], Int32)
   at Microsoft.PowerShell.ManagedPSEntry.Main(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)

Environment data

Note: $PSVersionTable cannot be run in PowerShell 7.6.6 because pwsh crashes immediately on startup before reaching an interactive prompt.

Visuals

No response

Activity

  1. rhubarb-geek-nz commented on Nov 3, 2026

    @rhubarb-geek-nz

    I think this is a duplicate of #28298 and #28131.

    This issue has been fixed in 7.6.8 onwards by the removal of the code that provided the update notification during startup.
    You can get round this in 7.6.6 by setting the documented env var POWERSHELL_UPDATECHECK to OFF and then upgrading PowerShell.

  2. added and removed
    Needs-TriageThe issue is new and needs to be triaged by a work group.
    on Nov 3, 2026
  3. kilasuit commented on Nov 3, 2026

    @kilasuit
    Collaborator

    jmeng111 (@jmeng111) - as noted above this has already been fixed as of 7.6.8 - please update to the latest supported version of PowerShell which is currently 7.6.9

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions