Skip to content

fix: throw explicit error when all semver-matching versions are quarantined#7056

Merged
arcanis merged 1 commit intoyarnpkg:masterfrom
ff1451:fix/#7041/No-Candidates-found
Mar 2, 2026
Merged

fix: throw explicit error when all semver-matching versions are quarantined#7056
arcanis merged 1 commit intoyarnpkg:masterfrom
ff1451:fix/#7041/No-Candidates-found

Conversation

@ff1451
Copy link
Contributor

@ff1451 ff1451 commented Mar 2, 2026

What's the problem this PR addresses?

When using npmMinimalAgeGate or npmPreapprovedPackages, if a semver range matches existing versions but all of them are quarantined, Yarn would silently return no candidates and throw a generic "No candidates found" error.

Closes #7041.

How did you fix it?

In NpmSemverResolver.getCandidates, split the filtering into two steps:

  1. First collect all versions that satisfy the semver range
  2. Then filter those by package approval

If step 1 yields results but step 2 yields none, throw an explicit ReportError with the message All versions satisfying "<range>" are quarantined, similar to the existing behavior in NpmTagResolver.

Updated the affected integration tests in npmMinimalAgeGate.test.ts to reflect the new error message.

Checklist

  • I have read the Contributing Guide.
  • I have set the packages that need to be released for my changes to be effective.
  • I will check that all automated PR checks pass before the PR gets reviewed.

@arcanis arcanis merged commit a972b52 into yarnpkg:master Mar 2, 2026
25 of 27 checks passed
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.

[Bug?]: No Candidates found

2 participants