PowerShell / PowerShell/PSResourceGet

Multiple Cmdlets emits unneeded log/errors

Open
#1,993 0 comments 1 reaction 3 assignees View on GitHub

@SydneyhSmith is already working on this.

Since Jul 21, 2026.

  • #2014 by @copilot-swe-agent — open
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
PS /tmp/jjj> $informationPreference = 'Continue'
PS /tmp/jjj> Get-PsResourceRepository

Name      Uri                                      Trusted Priority IsAllowedByPolicy
----      ---                                      ------- -------- -----------------
MAR       https://mcr.microsoft.com/               True    40       True
PSGallery https://www.powershellgallery.com/api/v2 False   50       True

PS /tmp/jjj> Save-PsResource -name az -Path . -TrustRepository -SkipDependencyCheck
Value of isRepositoryUnauthenticated: True
Value of isRepositoryUnauthenticated: True
PS /tmp/jjj> Save-PsResource -name azxx -Path . -TrustRepository -SkipDependencyCheck
Value of isRepositoryUnauthenticated: True
Save-PSResource: Response returned status code package: Not Found.
Save-PSResource: Package(s) 'azxx' could not be installed from registered repositories 'MAR, PSGallery'.
PS /tmp/jjj> Save-PsResource -name FormatMarkdownTable -Path . -TrustRepository -SkipDependencyCheck
Value of isRepositoryUnauthenticated: True
Save-PSResource: Response returned status code package: Not Found.

Information level message on every container registry server API call

https://github.com/PowerShell/PSResourceGet/blob/5b65686149e7c2464e4585e091d0113748e263f7/src/code/ContainerRegistryServerAPICalls.cs#L443

https://github.com/PowerShell/PSResourceGet/blob/5b65686149e7c2464e4585e091d0113748e263f7/test/PublishPSResourceTests/PublishPSResourceContainerRegistryServer.Tests.ps1#L364

  • Information level is being used to pass information to unit test(s)

Container registry server 404 error messages are emitted Cmdlet

in the log MAR API is returning 404 package names "azxxx" and "FormatMarkdownTable" which is normal but the because azxxx does not exist at all and FormatMarkdownTable is available only on powershell gallery. As user I don't need that kind of error messages. IMO error should be handled between Cmdlet and API call logic

Expected behavior
No misleading error messages or test related messages on information level
Actual behavior
-
Error details
Get-Error

Exception             :
    Type       : Microsoft.PowerShell.PSResourceGet.UtilClasses.ResourceNotFoundException
    TargetSite :
        Name          : MoveNext
        DeclaringType : [Microsoft.PowerShell.PSResourceGet.ContainerRegistryServerAPICalls+<SendRequestAsync>d__63]
        MemberType    : Method
        Module        : Microsoft.PowerShell.PSResourceGet.dll
    Message    : Response returned status code package: Not Found.
    Source     : Microsoft.PowerShell.PSResourceGet
    HResult    : -2146233088
    StackTrace :
   at Microsoft.PowerShell.PSResourceGet.ContainerRegistryServerAPICalls.SendRequestAsync(HttpRequestMessage message) in C:\__w\1\s\PSResourceGet\src\code\ContainerRegistryServerAPICalls.cs:line 1167
   at Microsoft.PowerShell.PSResourceGet.ContainerRegistryServerAPICalls.GetHttpResponseJObjectUsingDefaultHeaders(String url, HttpMethod method, Collection`1 defaultHeaders, ErrorRecord& errRecord, Boolean usePagination) in
C:\__w\1\s\PSResourceGet\src\code\ContainerRegistryServerAPICalls.cs:line 969
TargetObject          : Microsoft.PowerShell.PSResourceGet.Cmdlets.SavePSResource
CategoryInfo          : InvalidResult: (Microsoft.PowerShel…lets.SavePSResource:SavePSResource) [Save-PSResource], ResourceNotFoundException
FullyQualifiedErrorId : ResourceNotFound,Microsoft.PowerShell.PSResourceGet.Cmdlets.SavePSResource
InvocationInfo        :
    MyCommand        : Save-PSResource
    ScriptLineNumber : 1
    OffsetInLine     : 1
    HistoryId        : 15
    Line             : Save-PsResource -name FormatMarkdownTable -Path . -TrustRepository -SkipDependencyCheck
    Statement        : Save-PsResource -name FormatMarkdownTable -Path . -TrustRepository -SkipDependencyCheck
    PositionMessage  : At line:1 char:1
                       + Save-PsResource -name FormatMarkdownTable -Path . -TrustRepository -S …
                       + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    InvocationName   : Save-PsResource
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
      0
      1
Environment data
ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     1.2.0                 Microsoft.PowerShell.PSResourceGet  {Compress-PSResource, Find-PSResource, Get-InstalledPSResource, Get-PSResourceRepository…}

Key   : PSVersion
Value : 7.6.1
Name  : PSVersion


Key   : PSEdition
Value : Core
Name  : PSEdition


Key   : GitCommitId
Value : 7.6.1
Name  : GitCommitId


Key   : OS
Value : macOS 26.3.1
Name  : OS


Key   : Platform
Value : Unix
Name  : Platform


Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0…}
Name  : PSCompatibleVersions


Key   : PSRemotingProtocolVersion
Value : 2.4
Name  : PSRemotingProtocolVersion


Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion


Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion
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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.