-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Trying to update software using winget upgrade --all
: bad optional access
#4972
Comments
We've found some similar issues:
If any of the above are duplicates, please consider closing this issue out and adding additional context in the original issue.
|
I don't think I've seen this issue reported before. It looks like the pinning database isn't getting created if the path is empty. We'll look into this to see if we can fix it. In the meantime, I've got a couple of ideas to try and see if we can find a workaround. Try running If that doesn't fix it, I'd try adding a pin to one of your packages and then removing the pin. |
This isn't related to the actual problem but I wanted to point a out a couple of things:
You don't need to add that to your PATH, and generally you shouldn't need to touch (Also, the version number in that path doesn't look right. We don't have a 8.1.19411)
The pinning database (and all other winget data) is not in |
@denelon did what you asked and still getting the error. Your right as well, the pinning database isn't getting created. |
I think I found the problem. The only workaround is to upgrade one at a time, at least until you have upgraded one of the "conflicting" packages with dependencies. |
I should also have mentioned that I'm working on the fix right now and hope to have the PR out soon and the fix published this week. |
One more update: You actually should be able to avoid the problem (mostly) with |
winget upgrade --all
winget upgrade --all
: bad optional access
Likely fix for #4972 ## Change Use `std::optional` overloaded operator to handle all of the comparisons in `DependencyList::Add`. The operator already properly handles all of the cases, including treating `std::nullopt` as always less than a defined value. Also optimize a few other places around a reference to `MinVersion`. ## Validation Added a unit test covering the cases where `Add` needs to merge the minimum version value.
@JohnMcPMS Looks like the |
@JohnMcPMS : the command winget upgrade --all --skip-dependencies works well I ran it with absolutely no issues. |
) Likely fix for microsoft#4972 ## Change Use `std::optional` overloaded operator to handle all of the comparisons in `DependencyList::Add`. The operator already properly handles all of the cases, including treating `std::nullopt` as always less than a defined value. Also optimize a few other places around a reference to `MinVersion`. ## Validation Added a unit test covering the cases where `Add` needs to merge the minimum version value.
[Cherry pick #4987 to 1.9] Likely fix for #4972 ## Change Use `std::optional` overloaded operator to handle all of the comparisons in `DependencyList::Add`. The operator already properly handles all of the cases, including treating `std::nullopt` as always less than a defined value. Also optimize a few other places around a reference to `MinVersion`.
Brief description of your issue
Running the command
winget upgrade --all
and I'm getting an error ofAn unexpected error occurred while executing the command: Bad optional access
.Things I've tried:
winget source reset --force; winget source update
Manually Add
winget.exe
to PATH. I saw that I didn't have winget in my environment variable path so I added it with theC:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_8.1.19411.0_x64__8wekyb3d8bbwe
directory.I Tried to uninstall and reinstall the App installer but got a grey box.
Not sure if this will help but can't find the executable in file explorer.
Lastly, I tried renaming the pinning database but nothing like that is found in my file explorer.
System Specs:
winget --version v1.9.25180
Edition: Windows 11 Home
Version: 23H2
OS build: 22631.4460
Experience: Windows Feature Experience Pack 1000.22700.1047.0
Here is my logs -> WinGet-2024-11-15-08-26-37.950.log
I also seen issue #4909 but don't think the issue was resloved.
Steps to reproduce
Run the
winget upgrade --all
commandExpected behavior
To upgrade the packages.
Actual behavior
Not upgrading the packages.
Environment
The text was updated successfully, but these errors were encountered: