Skip to content

[BUG] npm audit signatures shows an opaque JSON error when the registry returns a non-JSON attestations response #10368

Backlog

Description

@Fariiixm

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

This is not just a request to bump a dependency for a CVE

  • This is not solely a request to bump a dependency for a CVE

Current Behavior

When the attestations endpoint returns a non-JSON body (here a CDN-cached text/plain "OK"), npm audit signatures fails with:

npm error code FETCH_ERROR
npm error invalid json response body at https://registry.npmjs.org/-/npm/v1/attestations/@typescript-eslint%2feslint-plugin@8.74.0 reason: Unexpected token 'O', "OK
" is not valid JSON

The message does not say that the registry served a bad response or what the user can do. It took header-level debugging (comparing CDN edges) to find out it was a registry-side cache problem: https://github.com/orgs/community/discussions/214163

Expected Behavior

A clear error that names the package and says the registry returned an invalid attestations response, for example:

npm error Could not verify attestations for @typescript-eslint/eslint-plugin@8.74.0: the registry returned an invalid response (content-type text/plain). This is usually a temporary registry problem; check https://status.npmjs.org or retry later.

Verification should still fail closed. Only the message needs to change.

Steps To Reproduce

From a client routed to the Cloudflare MAD edge (which currently serves a cached text/plain "OK" for this attestations URL):

mkdir repro && cd repro && npm init -y
npm install @typescript-eslint/eslint-plugin@8.74.0 --ignore-scripts
npm audit signatures

Result:

npm error code FETCH_ERROR
npm error invalid json response body at https://registry.npmjs.org/-/npm/v1/attestations/@typescript-eslint%2feslint-plugin@8.74.0 reason: Unexpected token 'O', "OK
" is not valid JSON

Environment

  • npm: 12.2.3 (also reproduced with 12.2.2)
  • Node.js: 24 (node:24-alpine)
  • OS Name: Alpine Linux (CI container)
  • System Model Name: CI runner (Docker executor)
  • npm config: defaults (reproduced in an empty project)

Activity

  1. added
    Bug
    Needs Triage
    on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugNeeds Triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions