Skip to content

fix: show yarn pnp errors as-is instead of NotFound error#939

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-24-fix_show_yarn_pnp_errors_as-is_instead_of_notfound_error
Dec 24, 2025
Merged

fix: show yarn pnp errors as-is instead of NotFound error#939
graphite-app[bot] merged 1 commit intomainfrom
12-24-fix_show_yarn_pnp_errors_as-is_instead_of_notfound_error

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Dec 24, 2025

Yarn pnp errors were output as NotFound and was a bit confusing.

Before:

{
  error: "Cannot find module 'use-sync-external-store/shim/with-selector.js'"
}

After:

{
  error: "zustand tried to access use-sync-external-store, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.\n" +
    '\n' +
    'Required package: use-sync-external-store (via "use-sync-external-store/shim/with-selector.js")\n' +
    'Required by: zustand@virtual:1c9ffcdd3c294d9f00a4700610b6eee225ba7496e9cf71f4e2c84e6a78adfb6d89ded76acac79698b89ce4168fbd26a40683c1459c3d813f8bbe6a6de1deb690#npm:5.0.9 (via /home/green/workspace/temp/oxc-resolver-yarn-pnp-bug/.yarn/__virtual__/zustand-virtual-88b9bb390c/4/.yarn/berry/cache/zustand-npm-5.0.9-1d6cab4a48-10c0.zip/node_modules/zustand/esm/)'
}

I got the message above by https://github.com/sapphi-red-repros/yarn-pnp-rust-error-message. It seems the error message is wrong as require.resolve shows

Error: zustand tried to access use-sync-external-store (a peer dependency) but it isn't provided by your application; this makes the require call ambiguous and unsound.

Required package: use-sync-external-store (via "use-sync-external-store/shim/with-selector.js")
Required by: zustand@virtual:1c9ffcdd3c294d9f00a4700610b6eee225ba7496e9cf71f4e2c84e6a78adfb6d89ded76acac79698b89ce4168fbd26a40683c1459c3d813f8bbe6a6de1deb690#npm:5.0.9 (via /home/green/workspace/temp/oxc-resolver-yarn-pnp-bug/.yarn/__virtual__/zustand-virtual-88b9bb390c/4/.yarn/berry/cache/zustand-npm-5.0.9-1d6cab4a48-10c0.zip/node_modules/zustand/esm/)
Ancestor breaking the chain: oxc-resolver-yarn-pnp-bug@workspace:.

But I think that's a separate problem.

Copy link
Member Author


How to use the Graphite Merge Queue

Add the label merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codecov
Copy link

codecov bot commented Dec 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.46%. Comparing base (baf1cf3) to head (1a6ca16).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #939   +/-   ##
=======================================
  Coverage   94.46%   94.46%           
=======================================
  Files          18       18           
  Lines        3325     3325           
=======================================
  Hits         3141     3141           
  Misses        184      184           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sapphi-red sapphi-red requested a review from Boshen December 24, 2025 06:32
@sapphi-red sapphi-red marked this pull request as ready for review December 24, 2025 06:33
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 24, 2025

CodSpeed Performance Report

Merging #939 will not alter performance

Comparing 12-24-fix_show_yarn_pnp_errors_as-is_instead_of_notfound_error (1a6ca16) with main (10833e2)1

Summary

✅ 12 untouched
⏩ 5 skipped2

Footnotes

  1. No successful run was found on main (1a6ca16) during the generation of this report, so 10833e2 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Copy link
Member

Boshen commented Dec 24, 2025

Merge activity

Yarn pnp errors were output as NotFound and was a bit confusing.

Before:
```
{
  error: "Cannot find module 'use-sync-external-store/shim/with-selector.js'"
}
```

After:
```
{
  error: "zustand tried to access use-sync-external-store, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.\n" +
    '\n' +
    'Required package: use-sync-external-store (via "use-sync-external-store/shim/with-selector.js")\n' +
    'Required by: zustand@virtual:1c9ffcdd3c294d9f00a4700610b6eee225ba7496e9cf71f4e2c84e6a78adfb6d89ded76acac79698b89ce4168fbd26a40683c1459c3d813f8bbe6a6de1deb690#npm:5.0.9 (via /home/green/workspace/temp/oxc-resolver-yarn-pnp-bug/.yarn/__virtual__/zustand-virtual-88b9bb390c/4/.yarn/berry/cache/zustand-npm-5.0.9-1d6cab4a48-10c0.zip/node_modules/zustand/esm/)'
}
```

I got the message above by https://github.com/sapphi-red-repros/yarn-pnp-rust-error-message. It seems the error message is wrong as `require.resolve` shows
```
Error: zustand tried to access use-sync-external-store (a peer dependency) but it isn't provided by your application; this makes the require call ambiguous and unsound.

Required package: use-sync-external-store (via "use-sync-external-store/shim/with-selector.js")
Required by: zustand@virtual:1c9ffcdd3c294d9f00a4700610b6eee225ba7496e9cf71f4e2c84e6a78adfb6d89ded76acac79698b89ce4168fbd26a40683c1459c3d813f8bbe6a6de1deb690#npm:5.0.9 (via /home/green/workspace/temp/oxc-resolver-yarn-pnp-bug/.yarn/__virtual__/zustand-virtual-88b9bb390c/4/.yarn/berry/cache/zustand-npm-5.0.9-1d6cab4a48-10c0.zip/node_modules/zustand/esm/)
Ancestor breaking the chain: oxc-resolver-yarn-pnp-bug@workspace:.
```
But I think that's a separate problem.
@graphite-app graphite-app bot force-pushed the 12-24-fix_show_yarn_pnp_errors_as-is_instead_of_notfound_error branch from 635352d to 1a6ca16 Compare December 24, 2025 06:50
@graphite-app graphite-app bot merged commit 1a6ca16 into main Dec 24, 2025
17 checks passed
@graphite-app graphite-app bot deleted the 12-24-fix_show_yarn_pnp_errors_as-is_instead_of_notfound_error branch December 24, 2025 06:53
@graphite-app graphite-app bot removed the merge label Dec 24, 2025
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.

2 participants