pnpm/pnpm · error · PnpmError
REGISTRY_ERROR
REGISTRY_ERROR
Error message
Failed to fetch package info: ${getResponse.status} ${getResponse.statusText} What it means
Thrown by `updateDeprecation` when the full-metadata fetch for the package fails with any non-404 error status. The command reports the raw HTTP status and statusText because at this point the failure is on the registry or network side — server errors, gateway problems, or a proxy interfering with the metadata request — rather than something wrong with the arguments.
Source
Thrown at pnpm11/registry-access/commands/src/deprecation/common.ts:57
const registryUrl = pickRegistryForPackage(opts.registriesByScope ?? { default: 'https://registry.npmjs.org/' }, packageName)
const getAuthHeader = createGetAuthHeaderByURI(opts.configByUri ?? {})
const authHeader = getAuthHeader(registryUrl, { pkgName: packageName })
const packageUrl = new URL(npa(packageName).escapedName, registryUrl).href
const fetchFromRegistry = createFetchFromRegistry(opts)
const getResponse = await fetchFromRegistry(packageUrl, {
authHeaderValue: authHeader,
fullMetadata: true,
})
if (!getResponse.ok) {
if (getResponse.status === 404) {
throw new PnpmError('PACKAGE_NOT_FOUND', `Package "${packageName}" not found in registry`)
}
throw new PnpmError('REGISTRY_ERROR', `Failed to fetch package info: ${getResponse.status} ${getResponse.statusText}`)
}
const pkg = await getResponse.json() as PackageMeta
if (!pkg.versions || Object.keys(pkg.versions).length === 0) {
throw new PnpmError('NO_VERSIONS', `Package "${packageName}" has no versions`)
}
const versionsToUpdate = versionRange
? getVersionsMatchingRange(pkg.versions, versionRange)
: Object.keys(pkg.versions)
if (versionsToUpdate.length === 0) {
throw new PnpmError('NO_MATCHING_VERSIONS', `No versions match "${versionRange}"`)
}
if (deprecated == null) {
const deprecatedVersions = versionsToUpdate.filter((ver) => pkg.versions[ver].deprecated)View on GitHub (pinned to 6261b7f388)
Solutions
- Retry after a short wait — transient 5xx responses usually clear on their own.
- Check the registry status page and basic reachability: `pnpm ping --registry <url>`.
- If a proxy is involved, confirm it forwards the metadata GET correctly and inspect its logs.
- Try against the public registry with `--registry https://registry.npmjs.org/` to isolate a private-registry problem.
Example fix
# before pnpm deprecate pkg "msg" # ERR_PNPM_REGISTRY_ERROR Failed to fetch package info: 503 Service Unavailable # after pnpm ping # wait until this succeeds pnpm deprecate pkg "msg"
Defensive patterns
Strategy: retry
Validate before calling
// pre-flight: confirm the registry answers before the metadata read
import { execSync } from 'child_process'
function assertRegistryHealthy (registry = 'https://registry.npmjs.org/'): void {
execSync(`pnpm ping --registry ${registry}`, { stdio: 'pipe' })
} Try / catch
async function deprecateWithRetry (run: () => Promise<string>, attempts = 3): Promise<string> {
for (let i = 0; i < attempts; i++) {
try {
return await run()
} catch (err) {
const code = 'code' in err ? (err as { code: string }).code : ''
const msg = err instanceof Error ? err.message : ''
if (code !== 'REGISTRY_ERROR' || !/\b5\d\d\b/.test(msg) || i === attempts - 1) throw err
await new Promise((r) => setTimeout(r, 2 ** i * 1000))
}
}
throw new Error('unreachable')
} Prevention
- Treat deprecation as retryable with backoff — the read that fails is a plain GET.
- Run `pnpm ping` before scheduled bulk deprecation jobs.
- Watch for proxy-induced 502s on large packument fetches (fullMetadata: true).
When it happens
Trigger: `pnpm deprecate pkg "msg"` while registry.npmjs.org returns 500/503 during an incident; a corporate proxy answering the metadata GET with 502; a private registry that errors on `fullMetadata: true` requests.
Common situations: npm registry incidents; rate limiting surfaced as 5xx by proxies; private registries with incomplete packument support; flaky VPN/office networks.
Related errors
AI-assisted analysis of pnpm/pnpm@6261b7f388 (2026-08-17).
Data as JSON: /api/errors/9d31fcbd50114fb5.
Report an issue: GitHub.