{"record":{"id":"ec4b999205bf70e1","repo":"yarnpkg/yarn","slug":"packagenotfoundregistry","errorCode":null,"errorMessage":"packageNotFoundRegistry","messagePattern":"packageNotFoundRegistry","errorType":"exception","errorClass":"MessageError","httpStatus":null,"severity":"error","filePath":"src/cli/commands/tag.js","lineNumber":45,"sourceCode":"    throw new MessageError(config.reporter.lang('unknownPackageName'));\n  }\n}\n\nasync function list(config: Config, reporter: Reporter, flags: Object, args: Array<string>): Promise<void> {\n  const name = await getName(args, config);\n\n  reporter.step(1, 1, reporter.lang('gettingTags'));\n  const tags = await config.registries.npm.request(`-/package/${name}/dist-tags`);\n\n  if (tags) {\n    reporter.info(`Package ${name}`);\n    for (const name in tags) {\n      reporter.info(`${name}: ${tags[name]}`);\n    }\n  }\n\n  if (!tags) {\n    throw new MessageError(reporter.lang('packageNotFoundRegistry', name, 'npm'));\n  }\n}\n\nasync function remove(config: Config, reporter: Reporter, flags: Object, args: Array<string>): Promise<boolean> {\n  if (args.length !== 2) {\n    return false;\n  }\n\n  const name = await getName(args, config);\n  const tag = args.shift();\n\n  reporter.step(1, 3, reporter.lang('loggingIn'));\n  const revoke = await getToken(config, reporter, name);\n\n  reporter.step(2, 3, reporter.lang('deletingTags'));\n  const result = await config.registries.npm.request(`-/package/${name}/dist-tags/${encodeURI(tag)}`, {\n    method: 'DELETE',\n  });","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/yarnpkg/yarn/blob/c2dda503f3759b5be5f0e24ecd9cf5c97a540147/src/cli/commands/tag.js#L27-L63","documentation":"Thrown by the 'list' subcommand after config.registries.npm.request('/-/package/<name>/dist-tags') returns a falsy value (null/undefined). The registry returned no dist-tags payload, meaning the package is not published on the configured registry.","triggerScenarios":"Running 'yarn tag' (list) for a package name that the registry does not know about, so the request resolves to null (404/empty). The `if (!tags)` guard fires.","commonSituations":"Package was never published; scoped package published to a private registry but queried on npmjs.org (or vice versa); wrong registry URL in .npmrc/.yarnrc; typo in the name; package is private.","solutions":["Publish the package first with 'yarn publish' (or 'npm publish').","Check the registry configuration: 'yarn config get registry' and any scope-registry mapping in .npmrc.","Confirm the package name spelling and scope match what is published.","If the package is private/unpublishable, do not run 'yarn tag' against it."],"exampleFix":"# before\n$ yarn tag my-pkg   # not yet published\n# after\n$ yarn publish\n$ yarn tag my-pkg","handlingStrategy":"try-catch","validationCode":"const tags = await config.registries.npm.request(`-/package/${name}/dist-tags`);\nif (!tags) {\n  throw new Error(`Package \"${name}\" has no dist-tags on the configured registry; publish it first.`);\n}","typeGuard":"function hasDistTags(v: unknown): v is Record<string, string> {\n  return v != null && typeof v === 'object' && !Array.isArray(v);\n}","tryCatchPattern":"try {\n  const tags = await config.registries.npm.request(`-/package/${name}/dist-tags`);\n  if (!tags) throw new Error(`packageNotFoundRegistry: ${name}`);\n} catch (err) {\n  // distinguish 404 (not published) from network errors\n  if (isHttpNotFound(err)) {\n    console.error(`Package ${name} is not published on this registry.`);\n  } else {\n    throw err;\n  }\n}","preventionTips":["Publish before tagging; gate 'yarn tag' behind a publish-success step in CI.","Verify scope-to-registry mappings in .npmrc so the lookup hits the right registry.","Use 'npm view <name>' to confirm the package exists before running 'yarn tag'."],"tags":["registry","network","publish","npm"],"backgroundTag":null,"analyzedSha":"c2dda503f3759b5be5f0e24ecd9cf5c97a540147","analyzedAt":"2026-08-13T04:17:06.305Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}