codex - 💡(How to fix) Fix The Install.ps1 doesn't return OSArchitecture correctly for all Windows PowerShell Versions Correctly [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#20782Fetched 2026-05-03 04:45:34
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1

Error Message

Under certain PowerShell configurations, that specific Property is filtered out, so it returns nothing and the script produces an error. Observe the error message that OSArchitecture doesn't exist on said object. The script succeeds and doesn't produce an error

RAW_BUFFERClick to expand / collapse

What issue are you seeing?

The Install.ps1 is leveraging this to pull the OS Architecture $architecture = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture

Under certain PowerShell configurations, that specific Property is filtered out, so it returns nothing and the script produces an error.

To ensure it returns properly across all PowerShell configurations. You should utilize this $architecture = [System.Runtime.InteropServices.RuntimeInformation,mscorlib]::OSArchitecture.ToString().ToLower()

What steps can reproduce the bug?

Open PowerShell 7 or 5.1 Install-Module PSReadLine -force Import-Module PSReadline .\Install.ps1 Observe the error message that OSArchitecture doesn't exist on said object.

What is the expected behavior?

The script succeeds and doesn't produce an error

Additional information

No response

extent analysis

TL;DR

Modify the Install.ps1 script to use the fully qualified namespace when accessing the OSArchitecture property to ensure compatibility across different PowerShell configurations.

Guidance

  • Update the line in Install.ps1 to use the fully qualified namespace: $architecture = [System.Runtime.InteropServices.RuntimeInformation,mscorlib]::OSArchitecture.ToString().ToLower()
  • Verify that the script runs without errors after making this change by re-running the steps to reproduce the bug
  • Test the script in both PowerShell 5.1 and PowerShell 7 to ensure compatibility
  • Consider adding error handling to the script to handle any potential issues with accessing the OSArchitecture property

Example

# Before
$architecture = [System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture

# After
$architecture = [System.Runtime.InteropServices.RuntimeInformation,mscorlib]::OSArchitecture.ToString().ToLower()

Notes

This fix assumes that the issue is solely due to the missing property in certain PowerShell configurations. If other issues arise, additional debugging may be necessary.

Recommendation

Apply workaround: Modify the Install.ps1 script to use the fully qualified namespace, as this ensures compatibility across different PowerShell configurations without requiring any version upgrades.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING