{"record":{"id":"68c42d6c5fb9f560","repo":"pnpm/pnpm","slug":"undeprecate-required","errorCode":"UNDEPRECATE_REQUIRED","errorMessage":"Package name is required","messagePattern":"Package name is required","errorType":"exception","errorClass":"PnpmError","httpStatus":null,"severity":"error","filePath":"pnpm11/registry-access/commands/src/deprecation/undeprecate.ts","lineNumber":42,"sourceCode":"            description: 'When publishing packages that require two-factor authentication, this option can specify a one-time password.',\n            name: '--otp',\n          },\n        ],\n      },\n    ],\n    url: docsUrl('undeprecate'),\n    usages: [\n      'pnpm undeprecate <package>[@<version>]',\n    ],\n  })\n}\n\nexport async function handler (\n  opts: DeprecateOptions,\n  params: string[]\n): Promise<string> {\n  if (params.length === 0) {\n    throw new PnpmError('UNDEPRECATE_REQUIRED', 'Package name is required')\n  }\n\n  if (params.length > 1) {\n    throw new PnpmError('UNDEPRECATE_NO_MESSAGE', 'The undeprecate command does not accept a message.')\n  }\n\n  const { name, versionRange } = parsePackageSpec(params[0])\n\n  return updateDeprecation(opts, { deprecated: undefined, packageName: name, versionRange })\n}\n","sourceCodeStart":24,"sourceCodeEnd":53,"githubUrl":"https://github.com/pnpm/pnpm/blob/6261b7f388016d57ca6b90340342411cd1d0d00f/pnpm11/registry-access/commands/src/deprecation/undeprecate.ts#L24-L53","documentation":"Usage error from the undeprecate handler: it was invoked with no positional parameters, so there is no package to operate on. Thrown before any registry access. Expected form: pnpm undeprecate <package>[@<version>].","triggerScenarios":"Bare pnpm undeprecate; pnpm undeprecate $PKG where PKG is empty; arguments lost to quoting in a script.","commonSituations":"Script variables empty in CI; copy-pasted command missing its argument.","solutions":["Pass a package spec: pnpm undeprecate mypkg or pnpm undeprecate mypkg@^1.0.0","Guard scripts against empty variables (set -u in bash)","Check pnpm undeprecate --help for the accepted form"],"exampleFix":"# before\npnpm undeprecate\n\n# after\npnpm undeprecate mypkg@1.0.0","handlingStrategy":"validation","validationCode":"if (params.length === 0) {\n  throw new Error('usage: pnpm undeprecate <package>[@<version>]')\n}\nawait handler(opts, params)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Assert the package variable is non-empty before invoking pnpm","Use set -u in shell scripts","Check pnpm undeprecate --help when unsure of the form"],"tags":["cli","arguments","undeprecate","usage"],"backgroundTag":"missing-required-argument","analyzedSha":"6261b7f388016d57ca6b90340342411cd1d0d00f","analyzedAt":"2026-08-17T18:30:54.750Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}