nodejs/node · warning · Error
${argv[2]} not recognized
Error message
${argv[2]} not recognized What it means
Thrown by `npm team`'s shell-completion handler when the third argv token (the subcommand) is not one of `create`, `destroy`, `add`, `rm`, `ls`. It is a tab-completion-time error telling the shell the user's subcommand is unknown.
Source
Thrown at deps/npm/lib/commands/team.js:38
'parseable',
'json',
]
static ignoreImplicitWorkspace = false
static async completion (opts) {
const { conf: { argv: { remain: argv } } } = opts
const subcommands = ['create', 'destroy', 'add', 'rm', 'ls']
if (argv.length === 2) {
return subcommands
}
if (subcommands.includes(argv[2])) {
return []
}
throw new Error(argv[2] + ' not recognized')
}
async exec ([cmd, entity = '', user = '']) {
// Entities are in the format <scope>:<team>
// XXX: "description" option to libnpmteam is used as a description of the team, but in npm's options
// this is a boolean meaning "show the description in npm search output".
// Hence its being set to null here.
await otplease(this.npm, { ...this.npm.flatOptions }, opts => {
entity = entity.replace(/^@/, '')
switch (cmd) {
case 'create': return this.create(entity, opts)
case 'destroy': return this.destroy(entity, opts)
case 'add': return this.add(entity, user, opts)
case 'rm': return this.rm(entity, user, opts)
case 'ls': {
const match = entity.match(/[^:]+:.+/)
if (match) {
return this.listUsers(entity, opts)View on GitHub (pinned to 1b2de5e052)
Solutions
- Use one of the documented subcommands: `npm team create|destroy|add|rm|ls`.
- For removing a user, the subcommand is `rm` (not `remove`).
- Run `npm team` with no subcommand to see usage.
Example fix
// before npm team rem @myorg:dev user // after npm team rm @myorg:dev user
Defensive patterns
Strategy: validation
Validate before calling
const TEAM_SUBCOMMANDS = ['create', 'destroy', 'add', 'rm', 'ls']
function assertTeamSubcommand(cmd) {
if (!TEAM_SUBCOMMANDS.includes(cmd)) {
throw new Error(`Unknown npm team subcommand "${cmd}". Valid: ${TEAM_SUBCOMMANDS.join(', ')}`)
}
} Type guard
function isTeamSubcommand(cmd) {
return ['create', 'destroy', 'add', 'rm', 'ls'].includes(cmd)
} Prevention
- Remember the removal subcommand is `rm`, not `remove`.
- Wrap `npm team` in scripts that validate the subcommand against the canonical list.
- Tab-complete subcommands instead of typing them.
When it happens
Trigger: Completion is invoked with `argv.length > 2` and `argv[2]` not in the recognized subcommand set (e.g. user typed `npm team foo<TAB>`).
Common situations: Tab-completing a misspelled subcommand (`npm team rem`); a shell completion script passing stale/extra tokens; using `remove`/`delete` instead of `rm`.
Related errors
- ${argv[2]} not recognized
- `npm rebuild` only supports SemVer version/range specifiers
- Missing script: "${event}"${suggestions} To see a list of s
- search must be called with arguments
- ${argv[2]} not recognized
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/4b6f36108621ebd3.
Report an issue: GitHub.