Visitar URL original
`pnpm dedupe --check` fails when only registry metadata (`deprecated`) changed, even though "no dependency resolution would change" · Issue #17198 · pnpm/pnpm · GitHub
Skip to content

pnpm dedupe --check fails when only registry metadata (deprecated) changed, even though "no dependency resolution would change" #17198

Closed

Description

@dnalborczyk

Verify latest release

  • I verified that the issue exists in the latest pnpm release

pnpm version

12.15.0

Which area(s) of pnpm are affected? (leave empty if unsure)

Lockfile, CLI (pnpm dedupe --check)

Link to the code that reproduces this issue or a replay of the bug

Self-contained steps below.

Reproduction steps

A lockfile written before a package was npm deprecated. This simulates it by deleting the deprecated: line:

mkdir repro && cd repro
echo '{"name":"repro","private":true,"dependencies":{"@opentelemetry/propagator-jaeger":"1.25.1"}}' > package.json
pnpm install --lockfile-only
sed -i '' '/deprecated: /d' pnpm-lock.yaml   # GNU: sed -i '/deprecated: /d'

pnpm install --frozen-lockfile   # exit 0
pnpm dedupe --check              # exit 1
[WARN] deprecated @opentelemetry/propagator-jaeger@1.25.1
[ERR_PNPM_DEDUPE_CHECK_ISSUES] Dedupe --check found changes to the lockfile
The lockfile would be rewritten, but no dependency resolution would change.
Run pnpm dedupe to apply the changes above.

Describe the Bug

deprecated is registry metadata that can change after a version is published. The lockfile stores it, and dedupe --check treats a difference in it as a failure, even though pnpm itself reports that no dependency resolution would change.

In practice this makes dedupe --check non-deterministic as a CI gate:

  • The same commit passes locally (warm metadata cache, older metadata) and fails in CI (cold cache, fresh metadata). We hit this today right after regenerating a lockfile: @opentelemetry/propagator-jaeger@1.25.1 and @opentelemetry/sdk-trace-node@1.25.1 were deprecated upstream, and CI failed while local runs passed.
  • Any PR can turn red, even one that doesn't touch dependencies, whenever someone upstream runs npm deprecate on a transitive dependency.

Related but distinct: #9398 (commands disagreeing on deprecated entries; closed as no longer reproducing on 12.5.1). Here the commands agree. The problem is that a metadata-only drift fails the check.

Expected Behavior

pnpm dedupe --check should only fail when dedupe would change dependency resolution. When the only difference is mutable metadata such as deprecated (the "no dependency resolution would change" case it already detects), it should exit 0, perhaps with a warning that the lockfile metadata is stale.

An alternative would be to keep post-publish-mutable metadata out of the lockfile entirely, but that's a much larger change.

Which Node.js version are you using?

24.22.1

Which operating systems have you used?

  • macOS
  • Windows
  • Linux

If your OS is a Linux based, which one it is? (Include the version if relevant)

Ubuntu (GitHub Actions arm64 runner)

Activity

  1. github-actions commented on Oct 21, 2026

    @github-actions
    Contributor

    @dnalborczyk, 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. self-assigned this
    on Oct 21, 2026
  3. slophisticated commented on Oct 21, 2026

    @slophisticated

    Additional version comparison on Windows 10 x64, Node.js 24.20.0, using the same pinned @opentelemetry/propagator-jaeger@1.25.1 dependency in a separate fresh directory for each pnpm version:

    pnpm install --frozen-lockfile after removing deprecated: dedupe --check
    11.28.6 exit 0 exit 0
    12.15.0 exit 0 exit 1, ERR_PNPM_DEDUPE_CHECK_ISSUES, “no dependency resolution would change”

    Both frozen installs preserved the lockfile without the deprecated: line. Both check commands left it unchanged. Running plain dedupe then added only that one deprecated: line in each version; stripping it again produced a byte-for-byte match with the pre-dedupe lockfile. A subsequent dedupe --check exited 0 in both versions.

    The test used the public npm registry, an isolated test store, and --ignore-scripts for installs/plain dedupe. This confirms the reported behavior on Windows and shows a difference between these two released versions; I haven't bisected the first affected release or tested a source fix.


    Written by an agent (OpenAI Codex, GPT-6).

  4. zkochan commented on Oct 21, 2026

    @zkochan
    Member

    Fix is in #17199. pnpm dedupe --check now passes when the lockfile differs only in deprecated notices. Any other rewrite still fails it, including config-dependency changes. pnpm v11 only compares resolutions in --check, so it was not affected. This covers the whole issue. It does not add the stale-metadata warning you suggested, because the run already prints the deprecated warning during resolution.


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

  5. added a commit that references this issue on Oct 21, 2026
    cbe5acc
  6. dnalborczyk commented on Oct 21, 2026

    @dnalborczyk
    ContributorAuthor

    thank you @zkochan !

  7. added a commit that references this issue on Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions