pnpm/pnpm · error · PnpmError

CONFIG_NO_SUBCOMMAND

CONFIG_NO_SUBCOMMAND

Error message

Please specify the subcommand

What it means

Usage error for the `pnpm config` command: invoked with zero parameters, so there is no subcommand to dispatch. `pnpm config` is a strictly subcommand-based verb (set, get, delete, list), and the error's hint embeds the help text showing the supported forms.

Source

Thrown at pnpm11/config/commands/src/config.ts:83

        ],
      },
    ],
    url: docsUrl('config'),
    usages: [
      'pnpm config set <key> <value>',
      'pnpm config get <key>',
      'pnpm config get --json <key>',
      'pnpm config delete <key>',
      'pnpm config list',
    ],
  })
}

export type ConfigHandlerResult = string | undefined | { output: string, exitCode: number }

export async function handler (opts: ConfigCommandOptions, params: string[]): Promise<ConfigHandlerResult> {
  if (params.length === 0) {
    throw new PnpmError('CONFIG_NO_SUBCOMMAND', 'Please specify the subcommand', {
      hint: help(),
    })
  }
  if (opts.location) {
    opts.global = opts.location === 'global'
  } else if (opts.cliOptions['global'] == null) {
    opts.global = true
  }
  switch (params[0]) {
    case 'set':
    case 'delete': {
      if (!params[1]) {
        throw new PnpmError('CONFIG_NO_PARAMS', `\`pnpm config ${params[0]}\` requires the config key`)
      }
      if (params[0] === 'set') {
        let [key, value] = params.slice(1)
        if (value == null) {
          const parts = key.split('=')

View on GitHub (pinned to 5b11d3a15b)

Solutions

  1. Use a subcommand: `pnpm config list` is the no-argument way to inspect settings
  2. Guard script variables: `pnpm config "${CMD:?}"`

Example fix

# before
pnpm config
# after
pnpm config list
Defensive patterns

Strategy: validation

Validate before calling

const subcommands = new Set(['set', 'get', 'delete', 'list'])
if (params.length === 0 || !subcommands.has(params[0])) {
  console.error('usage: pnpm config <set|get|delete|list> [args]')
  process.exit(1)
}

Prevention

When it happens

Trigger: `pnpm config` bare, or through a wrapper that failed to append the subcommand (empty variable). The check is `params.length === 0` before any location/global resolution happens.

Common situations: Users expecting `pnpm config` alone to list settings (npm-like muscle memory varies); shell functions like `pnpm config "$CMD"` with CMD unset.

Related errors


AI-assisted analysis of pnpm/pnpm@5b11d3a15b (2026-08-16). Data as JSON: /api/errors/efd05e47e713a0fc. Report an issue: GitHub.