Repository navigation
Open
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.
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
I have no particular steps to reliably reproduce this, unfortunately. I am writing a Rust program to escape arbitrary data into code that PowerShell can load to set environment variables. As part of this, I have a corpus of a few thousand samples of to test. I do get the error fairly regularly while running the test suite, but that could be in the first dozen runs of pwsh, or after a thousand or more test cases. This test process looks like this:
- Write a file called
./test, containing:
$Env:MYVAR = '...some escaped data here...'
./sample.shwhere sample.sh contains:
#!/usr/bin/env bash
echo -n "$MYVAR" | base64 -w0- Execute
pwsh ./test, and read stdout to capture the base64 encoded data I attempted to put in.
I run these two steps sequentially, for a few thousand inputs. I run one instance of pwsh at a time, no parallelism.
Expected behavior
pwsh should start up successfully every time, without emitting data to stderr.Actual behavior
Occasionally, and independently of the contents of the test file, pwsh outputs the following to stderr:
Call to 'procargs' failed with errno 5
Unhandled exception. Microsoft.PowerShell.ManagedPSEntry+StartupException: Exception of type 'Microsoft.PowerShell.ManagedPSEntry+StartupException' was thrown.
at Microsoft.PowerShell.ManagedPSEntry.ThrowOnFailure(String call, Int32 code)
at Microsoft.PowerShell.ManagedPSEntry.AttemptExecPwshLogin(String[] args)
at Microsoft.PowerShell.ManagedPSEntry.Main(String[] args)Error details
Call to 'procargs' failed with errno 5
Unhandled exception. Microsoft.PowerShell.ManagedPSEntry+StartupException: Exception of type 'Microsoft.PowerShell.ManagedPSEntry+StartupException' was thrown.
at Microsoft.PowerShell.ManagedPSEntry.ThrowOnFailure(String call, Int32 code)
at Microsoft.PowerShell.ManagedPSEntry.AttemptExecPwshLogin(String[] args)
at Microsoft.PowerShell.ManagedPSEntry.Main(String[] args)Environment data
PS /Users/grahamc/projects/export> $PSVersionTable
Name Value
---- -----
PSVersion 7.4.0
PSEdition Core
GitCommitId 7.4.0
OS Darwin 23.1.0 Darwin Kernel Version 23.1.0: Mon Oct 9 21:28:31 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T8112
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Visuals
n/a
Metadata
Metadata
Assignees
Labels
Needs-TriageThe issue is new and needs to be triaged by a work group.
Activity
[ci] Set __PWSH_LOGIN_CHECKED to avoid macOS pwsh 'procargs failed' s…
[ci] Set __PWSH_LOGIN_CHECKED to avoid macOS pwsh 'procargs failed' s…
simonrozsival commentedon Nov 22, 2026
We're seeing this intermittent startup failure in .NET for Android's Azure Pipelines CI. In build 1693717, PowerShell failed before entering the
set JDK variablesscript. The emulator had not started yet.Environment
macOS-15x64 image, version20260824.0482.1.$PSVersionTable, so the executable's version was not independently captured. Our pipeline uses the image's/usr/local/bin/pwshand does not pin PowerShell.2.283.0; the latter is the task version, not the PowerShell binary version.The agent initialization log identifies the OS and image. The failed task log shows this invocation and failure:
The script path above is abbreviated. The actual task sets JDK variables; it never ran. Retrying the job succeeded on the same image version. We don't have a deterministic standalone reproduction: local stress runs with PowerShell 7.5.2 on macOS 26.7.3 arm64 did not produce
procargserrno 5. InjectingEIOinto theKERN_PROCARGS2call locally reproduces the startup exception.The failure comes from the login-shell detection path, which passes a failing
sysctl(KERN_PROCARGS2)result toThrowOnFailure. The same fatal handling is present in the 7.7.0 source, although we haven't reproduced the failure on 7.7.0.Related reports and workarounds:
procargserrno 5 on macOS dotnet/android#12652 tracks the CI failures; [ci] Avoid macOS PowerShell startup failures dotnet/android#13709 proposes setting__PWSH_LOGIN_CHECKED=1in the shared CI variables.Setting
__PWSH_LOGIN_CHECKED=1skips the login-shell check and avoids the locally injected failure, but it relies on an undocumented variable that PowerShell consumes at startup, so nestedpwshprocesses aren't automatically protected.Could a failure to inspect the process arguments be handled without aborting PowerShell startup, for example by falling back to non-login behavior where appropriate?
Add workbench session management, activity monitoring, and toolbar co…