Skip to content

Skip crates deleted from crates.io during the Cargo update check - #5823

Merged
Gabriel Dufresne (GabrielDuf) merged 1 commit into
mainfrom
fix/cargo-deleted-crate-404
Nov 23, 2026
Merged

Gabriel Dufresne (GabrielDuf) merged 1 commit into
mainfrom
fix/cargo-deleted-crate-404

Conversation

@GabrielDuf

@GabrielDuf Gabriel Dufresne (GabrielDuf) commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #5818

Problem

A crate installed from crates.io and later deleted from it still appears in cargo install --list with no source, so UniGetUI treats it as a crates.io package and asks crates.io for its manifest during the update check. crates.io answers 404, and nothing in the update loop handled that per crate. The first deleted crate aborted the whole listing: Cargo never showed any update, and its update health never recorded a success.

Fix

Cargo.GetPackages now skips a crate whose manifest crates.io answers with 404, logs a warning, and keeps checking the other crates.

Only 404 is skipped. Any other failure, such as crates.io being down or rate-limiting, would affect every crate, so it still fails the check rather than recording an outage as a successful check with no updates. This matches how the NuGet managers treat a 404: the package is not on that feed, not a failed check.

Verified end to end (throwaway test, not committed)

The real Cargo manager ran the real cargo.exe (1.95.0) against a sandbox CARGO_HOME that lists the crate from the report, holographic-memory 0.6.1, next to sd 0.7.0. It queried the real crates.io through the public GetAvailableUpdates(), with the data folder and health file redirected to a temp folder:

Before After
Update check failed yes no
Updates none sd 0.7.0 -> 1.0.0
LastSuccessUtc null set
ConsecutiveFailures 1 0
LastFailureReason HttpRequestException: ... 404 (Not Found). none

A crate installed from crates.io and later deleted from it is still
listed by `cargo install --list` without a source, so it counts as a
crates.io package and the update check asks crates.io for its manifest.
crates.io answers 404, FetchAsync turns that into an
HttpRequestException, and nothing in the update loop caught it per
crate: the first deleted crate aborted the whole listing. Cargo's
update health never recorded a success and no update was ever offered
for any other crate.

The loop now skips a crate whose manifest crates.io answers with 404,
logging a warning, and keeps checking the rest. Only 404 is skipped:
it means the crate does not exist, the same way a 404 from a NuGet
feed means the package is not on that feed. Any other failure, such
as crates.io being down or rate-limiting, would hit every crate, so it
still fails the check rather than recording an outage as a successful
listing with no updates.

Fixes #5818

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues are reported for the change allowing Cargo update checks to continue past deleted crates.

No open issues 🎉

What changed in this PR

Addresses #5818 by allowing Cargo update checks to continue when an installed crate has been deleted from crates.io.

Changes:

  • Skips crates whose manifest request returns HTTP 404 and logs a warning.
  • Preserves failure reporting for other HTTP errors.
  • Adds regression tests for continuing after a 404 and propagating a 503.
File Description
src/​UniGetUI.PackageEngine.Tests/​CargoInventoryTests.cs Tests deleted-crate handling and service-unavailable failures.
src/​UniGetUI.PackageEngine.Managers.Cargo/​Cargo.cs Handles manifest HTTP 404 errors per crate without aborting update discovery.

Review effort: Balanced

@randy-but-a-ro randy-but-a-ro Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Pull request was approved automatically: the AI review is complete and all its review threads are resolved. 🎉

Integration Details
{
	"deliveryId": "9306cc20-e77b-11f1-8504-878a587f0ed7",
	"headSha": "cf953e6d738d95abe026ea1aab512e04ef7b1d2d",
	"reviewer": "copilot-pull-request-reviewer[bot]"
}

@GabrielDuf
Gabriel Dufresne (GabrielDuf) merged commit 8893f60 into main Nov 23, 2026
13 of 15 checks passed
@GabrielDuf
Gabriel Dufresne (GabrielDuf) deleted the fix/cargo-deleted-crate-404 branch November 23, 2026 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cargo

Development

Successfully merging this pull request may close these issues.

Cargo manager: one deleted-on-crates.io package makes the whole update list fail with HTTP 404

2 participants