{"record":{"id":"de9934bbc76f2e82","repo":"nodejs/node","slug":"argv-2-not-recognized-de9934","errorCode":null,"errorMessage":"${argv[2]} not recognized","messagePattern":"(.+?) not recognized","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"info","filePath":"deps/npm/lib/commands/profile.js","lineNumber":71,"sourceCode":"  static async completion (opts) {\n    var argv = opts.conf.argv.remain\n\n    if (!argv[2]) {\n      return ['enable-2fa', 'disable-2fa', 'get', 'set']\n    }\n\n    switch (argv[2]) {\n      case 'enable-2fa':\n      case 'enable-tfa':\n        return ['auth-and-writes', 'auth-only']\n\n      case 'disable-2fa':\n      case 'disable-tfa':\n      case 'get':\n      case 'set':\n        return []\n      default:\n        throw new Error(argv[2] + ' not recognized')\n    }\n  }\n\n  async exec (args) {\n    if (args.length === 0) {\n      throw this.usageError()\n    }\n\n    const [subcmd, ...opts] = args\n\n    switch (subcmd) {\n      case 'enable-2fa':\n      case 'enable-tfa':\n      case 'enable2fa':\n      case 'enabletfa':\n        return this.enable2fa(opts)\n      case 'disable-2fa':\n      case 'disable-tfa':","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/npm/lib/commands/profile.js#L53-L89","documentation":"Thrown by the npm `profile` command's shell-completion handler when the subcommand word at argv[2] does not match any recognized value: enable-2fa, enable-tfa, disable-2fa, disable-tfa, get, set. The completion function returns suggestion arrays for known subcommands and throws for anything else. This fires during tab-completion only.","triggerScenarios":"Triggered when the shell invokes npm's completion machinery and the word at position argv[2] is not a recognized profile subcommand. For example, tab-completing `npm profile foo<TAB>` passes a non-matching fragment into the default case.","commonSituations":"Stale shell completion cache after an npm upgrade. A misconfigured bash/zsh completion script. Typing an unknown subcommand prefix during tab-completion.","solutions":["Regenerate completions: `npm completion >> ~/.bashrc` then `source ~/.bashrc`","Verify you are tab-completing a valid subcommand: enable-2fa, disable-2fa, get, or set","Update npm: `npm install -g npm@latest` and refresh completions"],"exampleFix":"// No code fix — shell-completion path only\n// User fix:\n//   npm completion >> ~/.bashrc && source ~/.bashrc","handlingStrategy":"validation","validationCode":"const VALID_PROFILE_SUBCOMMANDS = ['enable-2fa', 'enable-tfa', 'disable-2fa', 'disable-tfa', 'get', 'set']\nfunction isValidProfileSubcommand(cmd) {\n  return VALID_PROFILE_SUBCOMMANDS.includes(cmd)\n}","typeGuard":"function isProfileSubcommand(cmd) {\n  return typeof cmd === 'string'\n    && ['enable-2fa', 'enable-tfa', 'disable-2fa', 'disable-tfa', 'get', 'set'].includes(cmd)\n}","tryCatchPattern":null,"preventionTips":["Regenerate completions after npm upgrades: `npm completion >> ~/.bashrc`","Keep npm updated so completion scripts match the installed version","When scripting, validate subcommands against the known list"],"tags":["npm","profile","shell-completion","cli"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}