{"record":{"id":"4b6f36108621ebd3","repo":"nodejs/node","slug":"argv-2-not-recognized-4b6f36","errorCode":null,"errorMessage":"${argv[2]} not recognized","messagePattern":"(.+?) not recognized","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"deps/npm/lib/commands/team.js","lineNumber":38,"sourceCode":"    'parseable',\n    'json',\n  ]\n\n  static ignoreImplicitWorkspace = false\n\n  static async completion (opts) {\n    const { conf: { argv: { remain: argv } } } = opts\n    const subcommands = ['create', 'destroy', 'add', 'rm', 'ls']\n\n    if (argv.length === 2) {\n      return subcommands\n    }\n\n    if (subcommands.includes(argv[2])) {\n      return []\n    }\n\n    throw new Error(argv[2] + ' not recognized')\n  }\n\n  async exec ([cmd, entity = '', user = '']) {\n    // Entities are in the format <scope>:<team>\n    // XXX: \"description\" option to libnpmteam is used as a description of the team, but in npm's options\n    // this is a boolean meaning \"show the description in npm search output\".\n    // Hence its being set to null here.\n    await otplease(this.npm, { ...this.npm.flatOptions }, opts => {\n      entity = entity.replace(/^@/, '')\n      switch (cmd) {\n        case 'create': return this.create(entity, opts)\n        case 'destroy': return this.destroy(entity, opts)\n        case 'add': return this.add(entity, user, opts)\n        case 'rm': return this.rm(entity, user, opts)\n        case 'ls': {\n          const match = entity.match(/[^:]+:.+/)\n          if (match) {\n            return this.listUsers(entity, opts)","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/npm/lib/commands/team.js#L20-L56","documentation":"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.","triggerScenarios":"Completion is invoked with `argv.length > 2` and `argv[2]` not in the recognized subcommand set (e.g. user typed `npm team foo<TAB>`).","commonSituations":"Tab-completing a misspelled subcommand (`npm team rem`); a shell completion script passing stale/extra tokens; using `remove`/`delete` instead of `rm`.","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."],"exampleFix":"// before\nnpm team rem @myorg:dev user\n// after\nnpm team rm @myorg:dev user","handlingStrategy":"validation","validationCode":"const TEAM_SUBCOMMANDS = ['create', 'destroy', 'add', 'rm', 'ls']\nfunction assertTeamSubcommand(cmd) {\n  if (!TEAM_SUBCOMMANDS.includes(cmd)) {\n    throw new Error(`Unknown npm team subcommand \"${cmd}\". Valid: ${TEAM_SUBCOMMANDS.join(', ')}`)\n  }\n}","typeGuard":"function isTeamSubcommand(cmd) {\n  return ['create', 'destroy', 'add', 'rm', 'ls'].includes(cmd)\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["team","completion","argument-validation","npm-cli"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}