PowerShell / PowerShell/PSResourceGet

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

Open
#1,789 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue-Bug
Dominant language
C#
Stars
576
Forks
114
Avg merge
1d 2h
Merged PRs (30d)
7

Description

Prerequisites
  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • 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

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

Reproduce the issue with Update-PSResource -Scope AllUsers while multiple repositories are registered, using the PowerShell 5.1 or 7 environments described. Compare behavior when a package name is supplied and when updating CurrentUser scope. Done means AllUsers updates no longer report packages missing from repositories that do not contain them.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
cli, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.