Skip to content

fix(registry): handle Poll::Pending from sparse registry source queries#431

Open
rconnol wants to merge 1 commit intokbknapp:masterfrom
rconnol:fix/sparse-registry-poll-pending
Open

fix(registry): handle Poll::Pending from sparse registry source queries#431
rconnol wants to merge 1 commit intokbknapp:masterfrom
rconnol:fix/sparse-registry-poll-pending

Conversation

@rconnol
Copy link
Copy Markdown

@rconnol rconnol commented Mar 8, 2026

Issue

Title: cargo outdated panics with sparse private registries: "Source should be ready"

Summary

cargo outdated panics (v0.17.0) or bails (v0.18.0) when used with a project that depends on a sparse private registry.

Details

When querying a sparse registry source, source.query_vec() returns Poll::Pending on the first call because sparse registries (HttpRegistry) fetch package metadata on-demand via HTTP. The first call initiates the async request and returns Pending — the data isn't available until block_until_ready() is called to drive the HTTP response to completion.

The current code in find_update() calls block_until_ready() once before query_vec(), which is a no-op for sparse registries since no requests are in flight yet. When query_vec() then returns Poll::Pending, it is treated as a fatal error.

Cargo itself handles this with a poll loop:
https://github.com/rust-lang/cargo/blob/60400187f/src/cargo/core/resolver/errors.rs#L479-L488

Steps to Reproduce

  1. Configure a sparse private registry in ~/.cargo/config.toml:
    [registries.my-registry]
    index = "sparse+https://my-registry.example.com/crates/cargo/"
  2. Have a project with a dependency from that registry
  3. Run cargo outdated

v0.17.0

thread 'main' panicked at src/cargo_ops/temp_project.rs:404:18:
Source should be ready

v0.18.0

Error: Querying source was unexpectedly pending

Expected Behavior

cargo outdated should query the sparse registry successfully and report outdated dependencies.


PR

Title: fix: handle Poll::Pending from sparse registry source queries

Summary

  • Use cargo's poll loop pattern to correctly handle Poll::Pending from sparse registry sources
  • Remove redundant block_until_ready() call that was a no-op for sparse registries

Details

Sparse registries (sparse+https://...) fetch package metadata on-demand via HTTP. The first
query_vec() call initiates the request and returns Poll::Pending. The fix replaces the
single query + bail with the same poll loop cargo itself uses:

https://github.com/rust-lang/cargo/blob/60400187f/src/cargo/core/resolver/errors.rs#L479-L488

Test plan

  • Tested locally against a project with sparse private registry dependencies
  • just ci passes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant