{"record":{"id":"438bda488a885dc4","repo":"withastro/astro","slug":"unable-to-resolve-packageinfo-name","errorCode":null,"errorMessage":"Unable to resolve \"${packageInfo.name}\"","messagePattern":"Unable to resolve \"(.+?)\"","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/upgrade/src/actions/verify.ts","lineNumber":147,"sourceCode":"\t\treturn false;\n\t}\n\tfor (const packageInfo of ctx.packages) {\n\t\tif (!packageInfo.targetVersion) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\nexport async function resolveTargetVersion(\n\tpackageInfo: PackageInfo,\n\tregistry: string,\n): Promise<void> {\n\tconst packageMetadata = await fetch(`${registry}/${packageInfo.name}`, {\n\t\theaders: { accept: 'application/vnd.npm.install-v1+json' },\n\t});\n\tif (packageMetadata.status >= 400) {\n\t\tthrow new Error(`Unable to resolve \"${packageInfo.name}\"`);\n\t}\n\tconst { 'dist-tags': distTags } = await packageMetadata.json();\n\tlet version = distTags[packageInfo.targetVersion];\n\tif (version) {\n\t\tconst currentCoerced = semverCoerce(packageInfo.currentVersion);\n\t\tconst targetParsed = semverParse(version);\n\t\t// If the dist-tag points to a version older than the installed one, fall back to latest.\n\t\tif (currentCoerced && targetParsed && semverGt(currentCoerced, targetParsed)) {\n\t\t\tpackageInfo.targetVersion = 'latest';\n\t\t\tversion = distTags.latest;\n\t\t} else {\n\t\t\tpackageInfo.tag = packageInfo.targetVersion;\n\t\t\tpackageInfo.targetVersion = version;\n\t\t}\n\t} else {\n\t\tpackageInfo.targetVersion = 'latest';\n\t\tversion = distTags.latest;\n\t}","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/withastro/astro/blob/52e6c34790cc8ac4e69e6135ace06049867e5c4a/packages/upgrade/src/actions/verify.ts#L129-L165","documentation":"The `@astrojs/upgrade` tool fetches package metadata from the npm registry (`GET {registry}/{name}`) to read dist-tags for each package it plans to upgrade. Any HTTP status >= 400 aborts with \"Unable to resolve \\\"<package>\\\"\". The error deliberately hides the status code; it means the registry lookup for that package name failed.","triggerScenarios":"Running `npx @astrojs/upgrade` (or `astro upgrade`) when a target package does not exist on the configured registry (404), the registry requires auth for it (401/403), or the network/proxy blocks the request (5xx). Also when `--registry` points at a mirror that lacks the package.","commonSituations":"Corporate npm proxy or private registry (Artifactory/Verdaccio) that hasn't cached the package; offline or DNS-broken environments; package name taken from a fork or internal alias that was never published; typo'd registry URL.","solutions":["Check connectivity and the package exists: `npm view <package> dist-tags --registry <registry>`","If you use a private registry, ensure you are authenticated (`npm whoami`) and the package is mirrored/published there","Pass the correct registry: `npx @astrojs/upgrade --registry https://registry.npmjs.org/`","If the failure is transient network flakiness, simply rerun the upgrade"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"async function registryHasPackage(registry: string, name: string): Promise<boolean> {\n  const res = await fetch(`${registry}/${name}`, { method: 'HEAD' });\n  return res.status < 400;\n}","typeGuard":null,"tryCatchPattern":"for (let attempt = 0; attempt < 3; attempt++) {\n  try {\n    await runUpgrade();\n    break;\n  } catch (e) {\n    if (e instanceof Error && e.message.startsWith('Unable to resolve') && attempt < 2) continue;\n    throw e;\n  }\n}","preventionTips":["Verify registry reachability and auth before running astro upgrade in CI","Pin `--registry` explicitly when a mirror is required","Confirm each package exists on the target registry with `npm view` first"],"tags":["upgrade","npm-registry","network","metadata-fetch"],"backgroundTag":"package-not-found-in-registry","analyzedSha":"52e6c34790cc8ac4e69e6135ace06049867e5c4a","analyzedAt":"2026-08-18T18:48:03.901Z","contentChangedAt":"2026-08-18T18:48:03.901Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}