Visitar URL original
Resolution failure is not actionable: error omits the failing package/specifier, debug output adds nothing, and a raw OS error leaks through (os error 123) · Issue #16590 · pnpm/pnpm · GitHub
Skip to content

Resolution failure is not actionable: error omits the failing package/specifier, debug output adds nothing, and a raw OS error leaks through (os error 123) #16590

Closed

Description

@bluelovers

Summary

When resolution fails because of a dependency specifier pnpm cannot handle, the error does not say which package, which version, or which specifier failed, and no reporter/log level adds that information. In addition, the underlying failure leaks out as a raw OS/filesystem error, which is misleading and not traceable back to any pnpm code path.

Error:   × installing dependencies
  ╰─▶ Failed to resolve dependency tree: Failed to resolve dependency: 檔案名稱、目錄名稱或磁碟區標籤語法錯誤。 (os error 123)

(檔案名稱、目錄名稱或磁碟區標籤語法錯誤。 is the localized Windows message for ERROR_INVALID_NAME, i.e. The filename, directory name, or volume label syntax is incorrect.)

This issue is not about whether pnpm should support that syntax — it is about the error reporting: the message is not actionable, the debugging output gives no extra detail, and there is no error code / traceable code path.

Reproduction

{
  "name": "probe",
  "version": "1.0.0",
  "dependencies": {
    "@yarnpkg/core": "4.9.2"
  }
}
pnpm install --lockfile-only

Result: the error above (os error 123 = ERROR_INVALID_NAME on Windows).

The previous version resolves fine, so nothing is wrong with the machine:

# with "@yarnpkg/core": "4.9.1" → resolves successfully
pnpm install --lockfile-only

Environment:

  • pnpm: 12.9.1
  • Node.js: v26.7.0
  • OS: Windows (build 10.0.26300), x64

Root cause (found manually, by chance)

@yarnpkg/core@4.9.2 publishes a yarn-only specifier in its package.json:

"got": "patch:got@npm%3A11.8.2#~/.yarn/patches/got-npm-11.8.2-c1eb105458.patch"

while 4.9.1 had the plain range:

"got": "^11.7.0"

pnpm cannot parse the specifier, and the failure ends up in the filesystem layer, so Windows reports os error 123.

Why this was so hard to debug

  1. No package identity in the message — no name, no version, no raw specifier, so there is nothing to search for.
  2. Debug/logging output adds nothing — --reporter ndjson, --loglevel debug, --ignore-scripts and --lockfile-only all produce the same two lines. The ndjson stream contains no event identifying the failing dependency.
  3. Misleading error class — a dependency-spec problem is reported as a raw OS error ((os error 123)), which reads as disk/filesystem corruption. I restarted the machine several times suspecting a failing disk.
  4. No traceable code path — no ERR_PNPM_* code, no pointer to the resolver stage that failed, so the message cannot be located in the pnpm source either.

Because of this, a lot of time went into wrong directions: deleting every node_modules and the global .pnpm-store, pnpm clean, pnpm store prune (machine-wide — every other project on the machine had to reinstall its dependencies), chasing unrelated deprecated warnings, allowedDeprecatedVersions, pnpm -r ls, copying single package.jsons into scratch folders, and several reboots suspecting hardware failure.

Suggested improvements

  • Include name@version and the raw dependency specifier of the failing dependency in the error message.
  • Emit a structured event with the same information for --reporter ndjson and --loglevel debug, so resolution failures can be traced without guessing.
  • Wrap filesystem errors that occur during specifier resolution in an ERR_PNPM_* error with context, instead of leaking the raw OS error as the only explanation.
  • Optionally provide a debug setting that logs each specifier as it is resolved, to locate the exact failing edge in the dependency graph.

Thanks for pnpm!

Activity

  1. github-actions commented on Oct 5, 2026

    @github-actions
    Contributor

    @bluelovers, are you planning to open a pull request for this? If so, reply here and a maintainer will assign the issue to you, so nobody else starts on the same fix.

  2. bluelovers commented on Oct 5, 2026

    @bluelovers
    Author

    @bluelovers, are you planning to open a pull request for this? If so, reply here and a maintainer will assign the issue to you, so nobody else starts on the same fix.

    no

  3. bluelovers commented on Oct 5, 2026

    @bluelovers
    Author

    Workaround we used (follow-up, not a change to the original report)

    While the reporting problem above still stands, here is the workaround we ended up applying in the project — pinning the range so the broken 4.9.2 is never selected:

    "@yarnpkg/core": "^4.9.1 !=4.9.2"

    Alternative, written with plain semver operators (also allows any fixed version published after 4.9.2):

    "@yarnpkg/core": "^4.9.1 <4.9.2 || >4.9.2 <5.0.0"

    Note this is only about dodging one bad release; the point of this issue is unchanged — resolution failures should name the failing package/specifier instead of leaving users with a bare os error.

  4. zkochan commented on Oct 5, 2026

    @zkochan
    Member

    Opened #16592. It fixes the os error 123 itself.

    The patch:got@npm%3A11.8.2#~/... specifier contains a /, so pnpm reads it as a local directory path. On Linux and macOS that path just doesn't exist, so pnpm warns ("Installing a dependency from a non-existent directory") and continues. On Windows the name is invalid, so reading it fails with ERROR_INVALID_NAME, and pnpm 12 didn't treat that as "missing". With the fix, Windows behaves like the other platforms and like pnpm 11. Any other error reading a package.json now names the file it failed on.

    The PR covers part of what you asked for. Naming the failing dependency and its parent chain in resolution errors is tracked separately in pnpm/tasks#73.


    Written by an agent (Claude Code, claude-opus-5-5).

  5. added a commit that references this issue on Oct 5, 2026
    1e5d031
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions