pnpm/pnpm · error · PnpmError

UNDEPRECATE_REQUIRED

UNDEPRECATE_REQUIRED

Error message

Package name is required

What it means

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>].

Source

Thrown at pnpm11/registry-access/commands/src/deprecation/undeprecate.ts:42

            description: 'When publishing packages that require two-factor authentication, this option can specify a one-time password.',
            name: '--otp',
          },
        ],
      },
    ],
    url: docsUrl('undeprecate'),
    usages: [
      'pnpm undeprecate <package>[@<version>]',
    ],
  })
}

export async function handler (
  opts: DeprecateOptions,
  params: string[]
): Promise<string> {
  if (params.length === 0) {
    throw new PnpmError('UNDEPRECATE_REQUIRED', 'Package name is required')
  }

  if (params.length > 1) {
    throw new PnpmError('UNDEPRECATE_NO_MESSAGE', 'The undeprecate command does not accept a message.')
  }

  const { name, versionRange } = parsePackageSpec(params[0])

  return updateDeprecation(opts, { deprecated: undefined, packageName: name, versionRange })
}

View on GitHub (pinned to 6261b7f388)

Solutions

  1. Pass a package spec: pnpm undeprecate mypkg or pnpm undeprecate mypkg@^1.0.0
  2. Guard scripts against empty variables (set -u in bash)
  3. Check pnpm undeprecate --help for the accepted form

Example fix

# before
pnpm undeprecate

# after
pnpm undeprecate mypkg@1.0.0
Defensive patterns

Strategy: validation

Validate before calling

if (params.length === 0) {
  throw new Error('usage: pnpm undeprecate <package>[@<version>]')
}
await handler(opts, params)

Prevention

When it happens

Trigger: Bare pnpm undeprecate; pnpm undeprecate $PKG where PKG is empty; arguments lost to quoting in a script.

Common situations: Script variables empty in CI; copy-pasted command missing its argument.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of pnpm/pnpm@6261b7f388 (2026-08-17). Data as JSON: /api/errors/68c42d6c5fb9f560. Report an issue: GitHub.