PowerShell / PowerShell/PSScriptAnalyzer

Install-Module for PSScriptAnalyzer Occasionally failing for version 1.23.0

Open
#2,051 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
2.2k
Forks
414
Avg merge
13h 1m
Merged PRs (30d)
2

Description

Steps to reproduce

Run the command

Install-Module -Name PSScriptAnalyzer -RequiredVersion 1.23.0 -Force -Scope CurrentUser

Expected behavior

The PSScriptAnalyzer module should install without issue.

Actual behavior

Occasionally I'm hitting the following exception (occurs roughly 1 out of every 20 times):

WARNING: Source Location 
'https://www.powershellgallery.com/api/v2/package/PSScriptAnalyzer/1.23.0' is 
not valid.
PackageManagement\Install-Package : Package 'PSScriptAnalyzer' failed to 
download.
At C:\Program 
Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 
char:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (C:\Users\Contai...tAnalyze 
   r.nupkg:String) [Install-Package], Exception
    + FullyQualifiedErrorId : PackageFailedInstallOrDownload,Microsoft.PowerSh 
   ell.PackageManagement.Cmdlets.InstallPackage

If an unexpected error was thrown then please report the full error details using e.g. $error[0] | Select-Object *

Environment data

> $PSVersionTable

TBD - need to get this info injected into our build pipeline where we're seeing this issue (not really an issue seen locally)

> (Get-Module -ListAvailable PSScriptAnalyzer).Version | ForEach-Object { $_.ToString() }

N/A (module hasn't been installed yet)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the reported PowerShell Install-Module command for PSScriptAnalyzer 1.23.0 repeatedly, then capture the missing $PSVersionTable data and full error details. Compare successful and failed attempts to determine whether the intermittent PowerShell Gallery download failure is reproducible; done means identifying a reliable cause and a verified installation outcome.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.