[BUG] OIDC failures aren't logged by default
Author: jedwards1211Created Aug 27, 2026Updated Sep 15, 2026
LabelsBug
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
If there's a problem exchanging an OIDC token during trusted publishing, it doesn't get logged by default, I just get:
npm error code ENEEDAUTH
npm error need auth This command requires you to be logged in to https://registry.npmjs.org/
npm error need auth You need to authorize this machine using `npm login`I can't tell from this if it even picked up my NPM_ID_TOKEN.
Only after I used --loglevel=silly did I see:
npm http fetch POST 404 https://registry.npmjs.org/-/npm/v1/oidc/token/exchange/package/@jcoreio%2ftoolchain 845ms
npm verbose oidc Failed token exchange request with body message: OIDC token exchange error - package not foundExpected Behavior
All OIDC failure messages in https://github.com/npm/cli/blob/latest/lib/utils/oidc.js are logged at error or warn level
(I'll be happy to make a PR if you agree)
Steps To Reproduce
- Set
NPM_ID_TOKENto an OIDC token that will error out for some reason (in my case, it had the CircleCI SSH rerun claim) - Run
npm publish(with default log level)
Environment
- npm: 12.0.2
- Node.js: 24.20.0
- OS Name: any
- System Model Name: any
- npm config: default
Source: npm/cli