{"record":{"id":"edf5a491585863bd","repo":"angular/angular-cli","slug":"unable-to-fetch-package-information-for-context","errorCode":null,"errorMessage":"Unable to fetch package information for '${context.packageIdentifier}': ${e.message}","messagePattern":"Unable to fetch package information for '(.+?)': (.+?)","errorType":"exception","errorClass":"CommandError","httpStatus":null,"severity":"error","filePath":"packages/angular/cli/src/commands/add/cli.ts","lineNumber":535,"sourceCode":"\n    return [...majorVersions.values()].sort((a, b) => compare(b, a, true));\n  }\n\n  private async loadPackageInfoTask(\n    context: AddCommandTaskContext,\n    task: AddCommandTaskWrapper,\n    options: Options<AddCommandArgs>,\n  ): Promise<void> {\n    const { registry } = options;\n\n    let manifest;\n    try {\n      manifest = await this.context.packageManager.getManifest(context.packageIdentifier, {\n        registry,\n      });\n    } catch (e) {\n      assertIsError(e);\n      throw new CommandError(\n        `Unable to fetch package information for '${context.packageIdentifier}': ${e.message}`,\n      );\n    }\n\n    if (!manifest) {\n      throw new CommandError(\n        `Unable to fetch package information for '${context.packageIdentifier}'.`,\n      );\n    }\n\n    // Avoid fully resolving the package version from the registry again in later steps\n    if (context.packageIdentifier.registry) {\n      assert(context.packageIdentifier.name, 'Registry package identifier must have a name');\n      context.packageIdentifier = npa.resolve(\n        context.packageIdentifier.name,\n        // `save-prefix` option is ignored by some package managers so the caret is needed to ensure\n        // that the value in the project package.json is correct.\n        (context.isExactVersion ? '' : '^') + manifest.version,","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular/cli/src/commands/add/cli.ts#L517-L553","documentation":"Thrown by loadPackageInfoTask when `packageManager.getManifest(packageIdentifier)` rejects. The original error is asserted to be an Error and its message is appended, so this error surfaces network failures, 404s, or auth errors from the registry while fetching the manifest for the package given to `ng add`.","triggerScenarios":"`this.context.packageManager.getManifest(context.packageIdentifier, { registry })` throws — registry unreachable (ENOTFOUND/ECONNREFUSED), HTTP 404 for unknown package, 401/403 for private packages, TLS/proxy failures.","commonSituations":"Offline development; VPN/corporate proxy blocking registry access; typo in package name; private scoped package without auth token in .npmrc; self-signed certificate or custom registry outage.","solutions":["Read the appended `${e.message}` — it names the root cause (DNS, 404, 401, etc.) and fix accordingly.","Confirm connectivity: `npm view <package>` against the same registry configured in .npmrc.","For private packages, add the correct auth token to .npmrc (`//registry.example.com/:_authToken=...`).","If offline, ensure the package tarball/cache is available locally or connect to the network/VPN and retry."],"exampleFix":"// before\nng add @mycompany/internal-lib   # 401 from private registry\n# after adding token to .npmrc\n// after\nnpm login --registry=https://registry.mycompany.com\nng add @mycompany/internal-lib","handlingStrategy":"retry","validationCode":"const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(pkg)}`);\nif (!res.ok) throw new Error(`Registry returned ${res.status} for ${pkg}`);","typeGuard":"function isFetchError(e: unknown): e is Error & { code?: string } {\n  return e instanceof Error && ('code' in e || typeof e.message === 'string');\n}","tryCatchPattern":"try {\n  await exec('ng', ['add', pkg, '--skip-confirmation']);\n} catch (e) {\n  if (e instanceof Error && /Unable to fetch package information/.test(e.message)) {\n    await waitForNetwork();      // backoff then retry\n    await exec('ng', ['add', pkg, '--skip-confirmation']);\n  } else throw e;\n}","preventionTips":["Check registry reachability at the start of CI jobs before running ng add.","Store auth tokens for private registries in .npmrc (via secret injection, not committed).","Retry transient network failures with exponential backoff.","Verify proxy/VPN settings when working behind corporate networks."],"tags":["network","registry","npm","authentication"],"backgroundTag":"registry-manifest-fetch-failed","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}