Set-PSResourceRepository fails on first run when PSResourceGet store directory does not exist
@alerickson ya está trabajando en esto.
Desde el 13/8/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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
On a fresh Linux environment where the PSResourceGet store directory does not exist, run the following:
Import-Module Microsoft.PowerShell.PSResourceGet
Remove-Item -Recurse -Force /home/vscode/.local/share/PSResourceGet -ErrorAction SilentlyContinue
Set-PSResourceRepository -Name PSGallery -Trusted
I also encountered this during a brand new GitHub Codespaces/devcontainer build, where postCreateCommand runs Set-PSResourceRepository -Name PSGallery -Trusted. A minimal first-run repro is enough to trigger the same problem
Observed notes:
Get-PSResourceRepositorycan return the defaultPSGalleryrepository.Set-PSRepository -Name PSGallery -InstallationPolicy Trusteddoes not fail in the same environment.- Creating the parent directory manually makes the PSResourceGet command succeed:
After that, this succeeds:mkdir -p /home/vscode/.local/share/PSResourceGetSet-PSResourceRepository -Name PSGallery -Trusted
Expected behavior
Set-PSResourceRepository should succeed on first run and create any missing parent directory or repository store file needed for PSResourceGet state.
Actual behavior
Set-PSResourceRepository fails before it can initialize the repository store:
Cannot retrieve the dynamic parameters for the cmdlet. Loading repository store failed: Could not find a part of the path '/home/vscode/.local/share/PSResourceGet/PSResourceRepository.xml'.
In the devcontainer build log, the same failure aborts postCreateCommand entirely:
2026-03-19 02:43:19.647Z: Running the postCreateCommand from devcontainer.json...
2026-03-19 02:43:19.647Z: pwsh .devcontainer/install-dev-tools.ps1 && bash ./.devcontainer/workspace-repositories-clone.sh
2026-03-19 02:43:20.940Z: Set-PSResourceRepository: /workspaces/excloud-runbooks-ghemu/.devcontainer/install-dev-tools.ps1:5
Line |
5 | Set-PSResourceRepository -Name PSGallery -Trusted
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot retrieve the dynamic parameters for the cmdlet. Loading
| repository store failed: Could not find a part of the path
| '/home/vscode/.local/share/PSResourceGet/PSResourceRepository.xml'.
2026-03-19 02:43:21.041Z: postCreateCommand from devcontainer.json failed with exit code 1. Skipping any further user-provided commands.
Error details
PSMessageDetails :
Exception : System.Management.Automation.ParameterBindingException:
Cannot retrieve the dynamic parameters for the
cmdlet. Loading repository store failed: Could not
find a part of the path '/home/vscode/.local/share/PSRe
sourceGet/PSResourceRepository.xml'.
---> System.Management.Automation.PSInvalidOperationEx
ception: Loading repository store failed: Could not
find a part of the path '/home/vscode/.local/share/PSRe
sourceGet/PSResourceRepository.xml'.
at Microsoft.PowerShell.PSResourceGet.UtilClasses.Re
positorySettings.Read(String[] repoNames, String[]&
errorList) in C:\__w\1\s\PSResourceGet\src\code\Reposit
orySettings.cs:line 603
at Microsoft.PowerShell.PSResourceGet.Cmdlets.SetPSR
esourceRepository.GetDynamicParameters() in C:\__w\1\s\
PSResourceGet\src\code\SetPSResourceRepository.cs:line
112
at System.Management.Automation.CmdletParameterBinde
rController.HandleCommandLineDynamicParameters(Paramete
rBindingException& outgoingBindingException)
--- End of inner exception stack trace ---
at System.Management.Automation.ExceptionHandlingOps
.CheckActionPreference(FunctionContext funcContext,
Exception exception)
at System.Management.Automation.Interpreter.ActionCa
llInstruction`2.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTry
CatchFinallyInstruction.Run(InterpretedFrame frame)
at System.Management.Automation.Interpreter.EnterTry
CatchFinallyInstruction.Run(InterpretedFrame frame)
TargetObject :
CategoryInfo : InvalidArgument: (:) [Set-PSResourceRepository],
ParameterBindingException
FullyQualifiedErrorId : GetDynamicParametersException,Microsoft.PowerShell.PSRe
sourceGet.Cmdlets.SetPSResourceRepository
ErrorDetails :
InvocationInfo : System.Management.Automation.InvocationInfo
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {}
Environment data
ModuleType Version PreRelease Name ExportedCommands
---------- ------- ---------- ---- ----------------
Binary 1.2.0 Microsoft.PowerShell.PSResourceGet {Compress-PSResource, Find-PSResource, Get-InstalledPSResource, Get-PSResourceRepository…}
Name Value
---- -----
PSVersion 7.6.0
PSEdition Core
GitCommitId 7.6.0
OS Ubuntu 24.04.4 LTS
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.4
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
- Lenguaje dominante
- C#
- Estrellas
- 576
- Forks
- 114
- Merge medio
- 23 h 17 min
- PR fusionados (30 d)
- 8
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PowerShell/PSResourceGet
-
Create parent directories only after the containment check in InstallHelper.TryExtractToDirectory Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
PowerShell/PSResourceGet#2056 ·
-
feature_request
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
PowerShell/PSResourceGet#2013 · 3 comentarios ·
-
feature_request Needs-Triage
PowerShell/PSResourceGet#2057 · 1 asignado ·
-
Needs-Triage
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
PowerShell/PSResourceGet#2055 ·
-
Needs-Triage
Dificultad 3/5 1-2 días Aptitud para principiantes 72/100
PowerShell/PSResourceGet#2054 ·
Todos los issues de PowerShell/PSResourceGet
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
bug needs response
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Adyen/adyen-dotnet-api-library#1869 ·
-
Status: Needs Triage Type: Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
bug effort:S P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
nightscout/nocturne#1602 ·