PowerShell tabs often stop with "process exited with code 5" (refer to #9973) #15306

Closed
opened 2026-01-31 04:34:32 +00:00 by claunia · 12 comments
Owner

Originally created by @SpitFire-666 on GitHub (Sep 22, 2021).

Windows Terminal version (or Windows build number)

10.0.19042.0

Other Software

No response

Steps to reproduce

[#9973 was closed as it was believed that OneDrive was the cause - I think I've found it's not]

Been hitting this issue on and off for a long time. I've now set the path to C:\ instead of OneDrive to try and rule it out from being the cause. Note that normal powershell (eg, sharing the same profile/paths/computer) has never shown me this error.

image

I can't find a way to reliably reproduce this unfortunately.

Found this in eventvwr:

Faulting application name: OpenConsole.exe, version: 1.10.2108.26003, time stamp: 0x6127f711
Faulting module name: ucrtbase.dll, version: 10.0.19041.789, time stamp: 0x2bd748bf
Exception code: 0xc0000409
Fault offset: 0x000000000007286e
Faulting process ID: 0x300c
Faulting application start time: 0x01d7aea619d677f7
Faulting application path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.10.2383.0_x64__8wekyb3d8bbwe\OpenConsole.exe
Faulting module path: C:\WINDOWS\System32\ucrtbase.dll
Report ID: 82794afe-193d-4a34-9945-17152592afe4
Faulting package full name: Microsoft.WindowsTerminal_1.10.2383.0_x64__8wekyb3d8bbwe
Faulting package-relative application ID: App

Expected Behavior

Terminal/PowerShell tab should continue working

Actual Behavior

PowerShell tab is dead and a new one needs to be opened

Originally created by @SpitFire-666 on GitHub (Sep 22, 2021). ### Windows Terminal version (or Windows build number) 10.0.19042.0 ### Other Software _No response_ ### Steps to reproduce [#9973 was closed as it was believed that OneDrive was the cause - I *think* I've found it's not] Been hitting this issue on and off for a long time. I've now set the path to C:\ instead of OneDrive to try and rule it out from being the cause. Note that normal powershell (eg, sharing the same profile/paths/computer) has never shown me this error. ![image](https://user-images.githubusercontent.com/38451588/134264394-bc783414-85ea-4351-8f8f-92daa5239fae.png) I can't find a way to reliably reproduce this unfortunately. Found this in eventvwr: ``` Faulting application name: OpenConsole.exe, version: 1.10.2108.26003, time stamp: 0x6127f711 Faulting module name: ucrtbase.dll, version: 10.0.19041.789, time stamp: 0x2bd748bf Exception code: 0xc0000409 Fault offset: 0x000000000007286e Faulting process ID: 0x300c Faulting application start time: 0x01d7aea619d677f7 Faulting application path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.10.2383.0_x64__8wekyb3d8bbwe\OpenConsole.exe Faulting module path: C:\WINDOWS\System32\ucrtbase.dll Report ID: 82794afe-193d-4a34-9945-17152592afe4 Faulting package full name: Microsoft.WindowsTerminal_1.10.2383.0_x64__8wekyb3d8bbwe Faulting package-relative application ID: App ``` ### Expected Behavior Terminal/PowerShell tab should continue working ### Actual Behavior PowerShell tab is dead and a new one needs to be opened
claunia added the Help WantedIssue-BugResolution-DuplicateProduct-Terminal labels 2026-01-31 04:34:32 +00:00
Author
Owner

@SpitFire-666 commented on GitHub (Sep 27, 2021):

Another of the same error. This happened after running $host.ui.RawUI.WindowSize then resizing the window (although I can't repro it using those steps):

Faulting application name: OpenConsole.exe, version: 1.10.2108.26003, time stamp: 0x6127f711
Faulting module name: ucrtbase.dll, version: 10.0.19041.789, time stamp: 0x2bd748bf
Exception code: 0xc0000409
Fault offset: 0x000000000007286e
Faulting process ID: 0x3368
Faulting application start time: 0x01d7b34f7dd1281e
Faulting application path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.10.2383.0_x64__8wekyb3d8bbwe\OpenConsole.exe
Faulting module path: C:\WINDOWS\System32\ucrtbase.dll
Report ID: 616542d6-df3f-473e-b430-faa88b050197
Faulting package full name: Microsoft.WindowsTerminal_1.10.2383.0_x64__8wekyb3d8bbwe
Faulting package-relative application ID: App

image

@SpitFire-666 commented on GitHub (Sep 27, 2021): Another of the same error. This happened after running `$host.ui.RawUI.WindowSize` then resizing the window (although I can't repro it using those steps): ``` Faulting application name: OpenConsole.exe, version: 1.10.2108.26003, time stamp: 0x6127f711 Faulting module name: ucrtbase.dll, version: 10.0.19041.789, time stamp: 0x2bd748bf Exception code: 0xc0000409 Fault offset: 0x000000000007286e Faulting process ID: 0x3368 Faulting application start time: 0x01d7b34f7dd1281e Faulting application path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.10.2383.0_x64__8wekyb3d8bbwe\OpenConsole.exe Faulting module path: C:\WINDOWS\System32\ucrtbase.dll Report ID: 616542d6-df3f-473e-b430-faa88b050197 Faulting package full name: Microsoft.WindowsTerminal_1.10.2383.0_x64__8wekyb3d8bbwe Faulting package-relative application ID: App ``` ![image](https://user-images.githubusercontent.com/38451588/134849832-6042ad3a-6f0a-4a6a-9c60-5c937a09d812.png)
Author
Owner

@SpitFire-666 commented on GitHub (Oct 5, 2021):

Sorry for the spam - hope this can help - it just crashed again:

Faulting application name: OpenConsole.exe, version: 1.10.2108.26003, time stamp: 0x6127f711
Faulting module name: ucrtbase.dll, version: 10.0.19041.789, time stamp: 0x2bd748bf
Exception code: 0xc0000409
Fault offset: 0x000000000007286e
Faulting process ID: 0x5608
Faulting application start time: 0x01d7ba393d38730b
Faulting application path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.10.2383.0_x64__8wekyb3d8bbwe\OpenConsole.exe
Faulting module path: C:\WINDOWS\System32\ucrtbase.dll
Report ID: f95d3f41-8f6a-4991-b49f-a3f090b11b49
Faulting package full name: Microsoft.WindowsTerminal_1.10.2383.0_x64__8wekyb3d8bbwe
Faulting package-relative application ID: App

image

@SpitFire-666 commented on GitHub (Oct 5, 2021): Sorry for the spam - hope this can help - it just crashed again: ``` Faulting application name: OpenConsole.exe, version: 1.10.2108.26003, time stamp: 0x6127f711 Faulting module name: ucrtbase.dll, version: 10.0.19041.789, time stamp: 0x2bd748bf Exception code: 0xc0000409 Fault offset: 0x000000000007286e Faulting process ID: 0x5608 Faulting application start time: 0x01d7ba393d38730b Faulting application path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.10.2383.0_x64__8wekyb3d8bbwe\OpenConsole.exe Faulting module path: C:\WINDOWS\System32\ucrtbase.dll Report ID: f95d3f41-8f6a-4991-b49f-a3f090b11b49 Faulting package full name: Microsoft.WindowsTerminal_1.10.2383.0_x64__8wekyb3d8bbwe Faulting package-relative application ID: App ``` ![image](https://user-images.githubusercontent.com/38451588/136112877-729e8d6b-e6b1-4cb8-96bf-0522c4d948d5.png)
Author
Owner

@DHowett commented on GitHub (Oct 6, 2021):

WOW! No, this is actually really great news!

This whole time, I've been looking for powershell crashes. This is a crash in the console host that is hosting powershell. That's a totally different beast.

Do you happen to have any dumps from OpenConsole on your system, or a "failure bucket hash" (from Event Viewer)

(I must have missed this thread. I'm sorry about that!)

@DHowett commented on GitHub (Oct 6, 2021): WOW! No, this is actually really great news! This whole time, I've been looking for powershell crashes. This is a crash in the console host that is hosting powershell. That's a totally different beast. Do you happen to have any dumps from OpenConsole on your system, or a "failure bucket hash" (from Event Viewer) (I must have missed this thread. I'm sorry about that!)
Author
Owner

@DHowett commented on GitHub (Oct 6, 2021):

Something about that Height: 5000 is really wigging me out. That really isn't supported when running inside Terminal, and we should do more to prevent it.

  1. Do you have anything in your powershell profile that forces the buffer size?

EDIT: Ignore this; I suspect that the "faulting address" belongs to ucrtbase, which is certainly not useful.
2. Curious, this crash is in alias expansion which shouldn't even be happening when you are using PSReadline

0:000> ln 00007ff7`76600000+0x7286e        <<<<< The base load address of OpenConsole plus "faulting address" from your dump
 [C:\a\_work\1\s\src\host\alias.cpp @ 953] (00007ff7`76672810)   OpenConsole!Alias::s_TryReplaceWildcardArgMacro+0x5e  
@DHowett commented on GitHub (Oct 6, 2021): Something about that `Height: 5000` is really wigging me out. That really isn't _supported_ when running inside Terminal, and we should do more to prevent it. 1. Do you have anything in your powershell profile that forces the buffer size? EDIT: Ignore this; I suspect that the "faulting address" belongs to ucrtbase, which is certainly not useful. 2. Curious, this crash is in _alias expansion_ which shouldn't even be happening when you are using PSReadline ``` 0:000> ln 00007ff7`76600000+0x7286e <<<<< The base load address of OpenConsole plus "faulting address" from your dump [C:\a\_work\1\s\src\host\alias.cpp @ 953] (00007ff7`76672810) OpenConsole!Alias::s_TryReplaceWildcardArgMacro+0x5e ```
Author
Owner

@DHowett commented on GitHub (Oct 6, 2021):

  1. Are you running any other applications in the same console session? Can you use Process Explorer to dump a list of Terminal's children?
@DHowett commented on GitHub (Oct 6, 2021): 3. Are you running any other applications in the same console session? Can you use Process Explorer to dump a list of Terminal's children?
Author
Owner

@SpitFire-666 commented on GitHub (Oct 18, 2021):

Thanks for the reply!

Do you happen to have any dumps from OpenConsole on your system, or a "failure bucket hash" (from Event Viewer)

Where would I find these?

  • Buffer height: yes - I've been setting that via my profile to 5000. I'll remove it.
    image

  • I also have $formatenumerationlimit = -1 in my profile

  • My profile is around 76 lines (mostly to connect to different services at startup, eg:
    image

  1. Alias expansion - my profile loads some functions that set their own aliases (outside of the profile) - could that be an issue?

  2. Not aware of any other apps in the console session, here's a screenshot, but note it's days after the crash(es):

image

If there's anything else I can gather, let me know. Note that I have this machine for only a few more days til I move jobs (hopefully the crashes don't follow me to a new company/machine!)

@SpitFire-666 commented on GitHub (Oct 18, 2021): Thanks for the reply! _Do you happen to have any dumps from OpenConsole on your system, or a "failure bucket hash" (from Event Viewer)_ Where would I find these? 1. - Buffer height: **yes** - I've been setting that via my profile to 5000. I'll remove it. ![image](https://user-images.githubusercontent.com/38451588/137675063-4ec20be4-d1ab-4b6d-875c-d62d00d8e659.png) - I also have `$formatenumerationlimit = -1 `in my profile - My profile is around 76 lines (mostly to connect to different services at startup, eg: ![image](https://user-images.githubusercontent.com/38451588/137675618-0e33d375-c2f2-4090-a640-513d6ae3de1b.png) 2. Alias expansion - my profile loads some functions that set their own aliases (outside of the profile) - could that be an issue? 3. Not aware of any other apps in the console session, here's a screenshot, but note it's days after the crash(es): ![image](https://user-images.githubusercontent.com/38451588/137676267-99c06769-ea64-4f99-a165-866e4227f919.png) If there's anything else I can gather, let me know. Note that I have this machine for only a few more days til I move jobs (hopefully the crashes don't follow me to a new company/machine!)
Author
Owner

@SpitFire-666 commented on GitHub (Oct 19, 2021):

Good news, I found a bunch of openconsole .dmp files and zipped them up here:

https://1drv.ms/u/s!AlE-uu5DK9rJgc5nYhpMo7qC_UM-qA?e=WXGGUy

@SpitFire-666 commented on GitHub (Oct 19, 2021): Good news, I found a bunch of openconsole .dmp files and zipped them up here: https://1drv.ms/u/s!AlE-uu5DK9rJgc5nYhpMo7qC_UM-qA?e=WXGGUy
Author
Owner

@sim590 commented on GitHub (Jun 9, 2022):

I also have these crashses. The only config I have in my profile are:

  oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\atomic.omp.json" | Invoke-Expression
  Set-PSReadlineOption -EditMode vi
  Set-PSReadlineKeyHandler -Key Ctrl+s -Function ForwardSearchHistory -ViMode Insert
  Set-PSReadlineKeyHandler -Key Ctrl+s -Function ForwardSearchHistory -ViMode Command
  Set-PSReadlineKeyHandler -Key Ctrl+r -Function ReverseSearchHistory -ViMode Insert
  Set-PSReadlineKeyHandler -Key Ctrl+r -Function ReverseSearchHistory -ViMode Command

For me, this happens after running a compilation script which makes use of MSBuild and overrides default logging functions during compilation process in order to make things "pretty". The screen is continuously updated on each line where the status of the compilation of the project goes from "compiling..." to "completed". This kind of rewriting of the stdout buffer may mess a bit with the Windows Terminal? Actually, I have noticed that it some parts of the log are missing sometimes (a few couple of consequent lines). This didn't happen before when I was using Cmder (ConEmu).

The missing lines are not just printed down below. They're just omitted. I'm mentioning this in order to emphasize on the fact that this logging tool doesn't seem to play nice with Windows Terminal.

I get the same message as OP, but I don't know how much time it takes after I ran the script before it happens:

image

It doesn't systematically happen, but I have never seen this happen in my terminal if I didn't first run the compilation script in the given terminal instance first. I have used ConEmu and more precisely Cmder for 2 years using this compilation script with PowerShell and I have never experienced this crash, so it seems to me like it is linked to the Windows Terminal. Or I guess that it could be linked to oh-my-posh ? I didn't have oh-my-posh before using Windows Terminal, so that also changed for me.

To be clear, I have multiple instances of the Windows Terminal with PowerShell spawned in the same directory and no instance crashses other than the one I ran the script in.

I also have this error in the Event Viewer which happened this morning when I just went back to use the computer so I may have done some user inputs (I ran the text in Google Translate. May be some words aren't right):

Faulting Application Name: OpenConsole.exe, Version: 1.12.2204.8002, Timestamp: 0x62508e2d
Faulting module name: ucrtbase.dll, version: 10.0.19041.789, timestamp: 0x2bd748bf
Exception code: 0xc0000409
Fault offset: 0x000000000007286e
Faulting Process ID: 0x6994
Faulting application start time: 0x01d87b9a654fb6c3
Faulting Application Path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.12.10982.0_x64__8wekyb3d8bbwe\OpenConsole.exe
Faulting module path: C:\windows\System32\ucrtbase.dll
Report code: 2178ec08-afd7-4cb4-835e-689950579b42
Faulting bundle full name: Microsoft.WindowsTerminal_1.12.10982.0_x64__8wekyb3d8bbwe
Failing Set Relative Application ID: App

This one happened yesterday at 8PM

Faulting Application Name: WindowsTerminal.exe, Version: 1.12.2204.8002, Timestamp: 0x62508e5a
Faulting module name: KERNELBASE.dll, version: 10.0.19041.1706, timestamp: 0x458acb5b
Exception code: 0xc000027b
Fault Offset: 0x000000000010fa32
Faulting Process ID: 0x444c
Faulting application start time: 0x01d87b773b3d69ad
Faulting Application Path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.12.10982.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe
Faulting module path: C:\windows\System32\KERNELBASE.dll
Report code: 300256ec-f237-4772-87e6-8b15644e5a22
Faulting bundle full name: Microsoft.WindowsTerminal_1.12.10982.0_x64__8wekyb3d8bbwe
Failing Set Relative Application ID: App

And this one has the same timestamp as the last one:

Faulting Application Name: OpenConsole.exe, Version: 1.12.2204.8002, Timestamp: 0x62508e2d
Faulting module name: ucrtbase.dll, version: 10.0.19041.789, timestamp: 0x2bd748bf
Exception code: 0xc0000409
Fault offset: 0x000000000007286e
Faulting Process ID: 0x7370
Faulting application start time: 0x01d87b9376eadfb9
Faulting Application Path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.12.10982.0_x64__8wekyb3d8bbwe\OpenConsole.exe
Faulting module path: C:\windows\System32\ucrtbase.dll
Report code: a4973d73-e1cf-484d-8114-ad28b1bbdfe7
Faulting bundle full name: Microsoft.WindowsTerminal_1.12.10982.0_x64__8wekyb3d8bbwe
Failing Set Relative Application ID: App

I too have a bunch of .dmp files

image

Tell me if it'd be useful to upload them.

@sim590 commented on GitHub (Jun 9, 2022): I also have these crashses. The only config I have in my profile are: ``` oh-my-posh init pwsh --config "$env:POSH_THEMES_PATH\atomic.omp.json" | Invoke-Expression Set-PSReadlineOption -EditMode vi Set-PSReadlineKeyHandler -Key Ctrl+s -Function ForwardSearchHistory -ViMode Insert Set-PSReadlineKeyHandler -Key Ctrl+s -Function ForwardSearchHistory -ViMode Command Set-PSReadlineKeyHandler -Key Ctrl+r -Function ReverseSearchHistory -ViMode Insert Set-PSReadlineKeyHandler -Key Ctrl+r -Function ReverseSearchHistory -ViMode Command ``` For me, this happens after running a compilation script which makes use of MSBuild and overrides default logging functions during compilation process in order to make things "pretty". The screen is continuously updated on each line where the status of the compilation of the project goes from "compiling..." to "completed". This kind of rewriting of the stdout buffer may mess a bit with the Windows Terminal? Actually, I have noticed that it some parts of the log are missing sometimes (a few couple of consequent lines). This didn't happen before when I was using Cmder (ConEmu). <img src="https://user-images.githubusercontent.com/4147254/172922002-ea7bf5cf-3c36-4e00-b5e4-ce59ac3870af.png" alt="" width="500px" /> The missing lines are not just printed down below. They're just omitted. I'm mentioning this in order to emphasize on the fact that this logging tool doesn't seem to play nice with Windows Terminal. I get the same message as OP, but I don't know how much time it takes after I ran the script before it happens: ![image](https://user-images.githubusercontent.com/4147254/172889992-cf295622-1214-44ea-a81a-9e63a7b3a9ae.png) It doesn't systematically happen, but I have never seen this happen in my terminal if I didn't first run the compilation script in the given terminal instance first. I have used ConEmu and more precisely Cmder for 2 years using this compilation script with PowerShell and I have never experienced this crash, so it seems to me like it is linked to the Windows Terminal. Or I guess that it could be linked to oh-my-posh ? I didn't have oh-my-posh before using Windows Terminal, so that also changed for me. To be clear, I have multiple instances of the Windows Terminal with PowerShell spawned in the same directory and no instance crashses other than the one I ran the script in. I also have this error in the Event Viewer which happened this morning when I just went back to use the computer so I may have done some user inputs (I ran the text in Google Translate. May be some words aren't right): ``` Faulting Application Name: OpenConsole.exe, Version: 1.12.2204.8002, Timestamp: 0x62508e2d Faulting module name: ucrtbase.dll, version: 10.0.19041.789, timestamp: 0x2bd748bf Exception code: 0xc0000409 Fault offset: 0x000000000007286e Faulting Process ID: 0x6994 Faulting application start time: 0x01d87b9a654fb6c3 Faulting Application Path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.12.10982.0_x64__8wekyb3d8bbwe\OpenConsole.exe Faulting module path: C:\windows\System32\ucrtbase.dll Report code: 2178ec08-afd7-4cb4-835e-689950579b42 Faulting bundle full name: Microsoft.WindowsTerminal_1.12.10982.0_x64__8wekyb3d8bbwe Failing Set Relative Application ID: App ``` This one happened yesterday at 8PM ``` Faulting Application Name: WindowsTerminal.exe, Version: 1.12.2204.8002, Timestamp: 0x62508e5a Faulting module name: KERNELBASE.dll, version: 10.0.19041.1706, timestamp: 0x458acb5b Exception code: 0xc000027b Fault Offset: 0x000000000010fa32 Faulting Process ID: 0x444c Faulting application start time: 0x01d87b773b3d69ad Faulting Application Path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.12.10982.0_x64__8wekyb3d8bbwe\WindowsTerminal.exe Faulting module path: C:\windows\System32\KERNELBASE.dll Report code: 300256ec-f237-4772-87e6-8b15644e5a22 Faulting bundle full name: Microsoft.WindowsTerminal_1.12.10982.0_x64__8wekyb3d8bbwe Failing Set Relative Application ID: App ``` And this one has the same timestamp as the last one: ``` Faulting Application Name: OpenConsole.exe, Version: 1.12.2204.8002, Timestamp: 0x62508e2d Faulting module name: ucrtbase.dll, version: 10.0.19041.789, timestamp: 0x2bd748bf Exception code: 0xc0000409 Fault offset: 0x000000000007286e Faulting Process ID: 0x7370 Faulting application start time: 0x01d87b9376eadfb9 Faulting Application Path: C:\Program Files\WindowsApps\Microsoft.WindowsTerminal_1.12.10982.0_x64__8wekyb3d8bbwe\OpenConsole.exe Faulting module path: C:\windows\System32\ucrtbase.dll Report code: a4973d73-e1cf-484d-8114-ad28b1bbdfe7 Faulting bundle full name: Microsoft.WindowsTerminal_1.12.10982.0_x64__8wekyb3d8bbwe Failing Set Relative Application ID: App ``` I too have a bunch of `.dmp` files ![image](https://user-images.githubusercontent.com/4147254/172893867-2b42662c-a17d-400f-908e-b6175ef2a621.png) Tell me if it'd be useful to upload them.
Author
Owner

@sim590 commented on GitHub (Jun 9, 2022):

I just tried removing my config and I had the same Terminal/PowerShell crash so it is not linked to powershell config it seems.

@sim590 commented on GitHub (Jun 9, 2022): I just tried removing my config and I had the same Terminal/PowerShell crash so it is not linked to powershell config it seems.
Author
Owner

@sim590 commented on GitHub (Jun 10, 2022):

I have noticed that this happens in either Cmd or Powershell for me. So it doesn't seem linked to Powershell, but may be exclusively OpenConsole.exe ?

@sim590 commented on GitHub (Jun 10, 2022): I have noticed that this happens in either Cmd or Powershell for me. So it doesn't seem linked to Powershell, but may be exclusively `OpenConsole.exe` ?
Author
Owner

@lhecker commented on GitHub (Jul 7, 2022):

I believe this was fixed as part of #13193.
/dup #13193

@lhecker commented on GitHub (Jul 7, 2022): I believe this was fixed as part of #13193. /dup #13193
Author
Owner

@ghost commented on GitHub (Jul 7, 2022):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (Jul 7, 2022): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#15306