PSResourceGet icon indicating copy to clipboard operation
PSResourceGet copied to clipboard

`Update-PSResource` complains about not finding packages when multiple repositories are registered

Open peetrike opened this issue 11 months ago • 0 comments

Prerequisites

  • [x] Write a descriptive title.
  • [x] Make sure you are able to repro it on the latest released version
  • [x] Search the existing issues.

Steps to reproduce

When updating packages in AllUsers scope, the Update-PSResource cmdlet complains (with ErrorRecord) about not finding packages from repositories. Packages from PSGallery are searched from local repository and vice versa.

When package name is provided, no error messages occur.

The problem does not occur when packages are updated on CurrentUser scope

  • PowerShell 5.1 complains about not finding local packages from PSGallery.
  • PowerShell 7 complains about not finding public packages from local repository.

Expected behavior

Update-PSResource -Scope AllUsers

no error messages

Actual behavior

Update-PSResource -Scope AllUsers
Update-PSResource: Package with name CompletionPredictor could not be found in repository 'LocalRepo'.
. . .

Error details

Exception             :
    Type    : Microsoft.PowerShell.PSResourceGet.UtilClasses.ResourceNotFoundException
    Message : Package with name CompletionPredictor could not be found in repository 'LocalRepo'.
    HResult : -2146233088
TargetObject          : Microsoft.PowerShell.PSResourceGet.Cmdlets.LocalServerAPICalls
CategoryInfo          : ResourceUnavailable: (Microsoft.PowerShel…LocalServerAPICalls:LocalServerAPICalls) [Update-PSRe
source], ResourceNotFoundException
FullyQualifiedErrorId : PackageNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.UpdatePSResource
InvocationInfo        :
    MyCommand        : Update-PSResource
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 38
    Line             : Update-PSResource -Scope AllUsers
    Statement        : Update-PSResource -Scope AllUsers
    PositionMessage  : At line:1 char:1
                       + Update-PSResource -Scope AllUsers
                       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : Update-PSResource
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
      0
      1

Environment data

  • OS: Windows 10
  • PowerShell: 5.1, 7.5.0
  • PSResourceGet: 1.1.0

Visuals

No response

peetrike avatar Feb 07 '25 16:02 peetrike