{"record":{"id":"322456cb198ec1d2","repo":"angular/angular-cli","slug":"unable-to-fetch-package-information-for-context-322456","errorCode":null,"errorMessage":"Unable to fetch package information for '${context.packageIdentifier}'.","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":541,"sourceCode":"    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,\n      );\n    }\n\n    context.hasSchematics = !!manifest.schematics;\n    context.savePackage = manifest['ng-add']?.save;\n    context.collectionName = manifest.name;","sourceCodeStart":523,"sourceCodeEnd":559,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular/cli/src/commands/add/cli.ts#L523-L559","documentation":"Companion error to [16]: thrown by loadPackageInfoTask when getManifest resolves successfully but returns a falsy manifest. The CLI cannot continue resolving the package version or entry point, so it throws this message-less CommandError.","triggerScenarios":"`packageManager.getManifest(...)` resolves to null/undefined — typically when the underlying package manager implementation cannot find the manifest for the identifier (nonexistent package, malformed name/spec that resolves to nothing) without raising an exception.","commonSituations":"Misspelled or empty package identifier; passing a local path or tag that the package manager silently fails to resolve; registry returning an empty payload for an unpublished package.","solutions":["Double-check the exact package name/spec passed to `ng add` (spelling, scope, version tag).","Run `npm view <name>@<spec>` to confirm the registry returns a manifest for that exact specifier.","Use an explicit version/tag (e.g. `ng add @angular/cli@latest`) instead of an ambiguous specifier.","If using a mirror/private registry, verify it proxies the package correctly."],"exampleFix":"// before\nng add material\n// after\nng add @angular/material","handlingStrategy":"validation","validationCode":"const manifest = child.execSync(`npm view ${spec} name version`, { encoding: 'utf8' });\nif (!manifest.trim()) throw new Error(`No manifest found for ${spec}`);","typeGuard":"function isValidPackageSpec(spec: string): boolean {\n  return /^(@[a-z0-9-~][a-z0-9-._~]*\\/)?[a-z0-9-~][a-z0-9-._~]*(@[a-z0-9-._~]+)?$/.test(spec);\n}","tryCatchPattern":"try {\n  await runNgAdd(spec);\n} catch (e) {\n  if (e instanceof Error && e.message.includes(\"Unable to fetch package information for '\")) {\n    console.error(`Check package spec '${spec}': not found on registry.`);\n  }\n  throw e;\n}","preventionTips":["Validate package names against npm naming rules before invoking ng add.","Use explicit, existing version tags rather than bare or invented specifiers.","Confirm unpublished/renamed packages against `npm view` output.","Keep registry mirrors in sync; stale mirrors can return empty manifests."],"tags":["npm","registry","validation","package-name"],"backgroundTag":"package-manifest-not-found","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}