{"record":{"id":"32eb1444da7ad981","repo":"nodejs/node","slug":"argv-2-not-recognized","errorCode":null,"errorMessage":"${argv[2]} not recognized","messagePattern":"(.+?) not recognized","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"deps/npm/lib/commands/access.js","lineNumber":68,"sourceCode":"    if (argv.length === 2) {\n      return commands\n    }\n\n    if (argv.length === 3) {\n      switch (argv[2]) {\n        case 'grant':\n          return ['read-only', 'read-write']\n        case 'revoke':\n          return []\n        case 'list':\n        case 'ls':\n          return ['packages', 'collaborators']\n        case 'get':\n          return ['status']\n        case 'set':\n          return setCommands\n        default:\n          throw new Error(argv[2] + ' not recognized')\n      }\n    }\n  }\n\n  async exec ([cmd, subcmd, ...args]) {\n    if (!cmd) {\n      throw this.usageError()\n    }\n    if (!commands.includes(cmd)) {\n      throw this.usageError(`${cmd} is not a valid access command`)\n    }\n    // All commands take at least one more parameter so we can do this check up front\n    if (!subcmd) {\n      throw this.usageError()\n    }\n\n    switch (cmd) {\n      case 'grant':","sourceCodeStart":50,"sourceCodeEnd":86,"githubUrl":"https://github.com/nodejs/node/blob/1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e/deps/npm/lib/commands/access.js#L50-L86","documentation":"During shell tab-completion for `npm access`, the static completion handler returns the valid next tokens for known subcommands (grant/revoke/list/ls/get/set) but throws '<token> not recognized' for anything else. This is a completion-time error, not raised by normal exec (exec uses usageError instead).","triggerScenarios":"Triggering completion (npm access <TAB> or a custom completer) with a token that is not one of the recognized subcommands. Stale shell completion scripts that send an outdated token list can also surface it.","commonSituations":"Old bash/zsh completion cached from a previous npm version; a wrapper that calls npm completion programmatically with an invalid subcommand.","solutions":["Use a valid access subcommand: grant, revoke, list (ls), get, or set","Regenerate shell completion via `npm completion >> ~/.bashrc` (or zsh equivalent) to refresh the token list","If calling completion programmatically, restrict the candidate token to the documented set"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const valid = ['grant', 'revoke', 'list', 'ls', 'get', 'set']\nif (!valid.includes(token)) {\n  // skip emitting the token in completion output\n}","typeGuard":"function isAccessSubcommand(t) {\n  return ['grant', 'revoke', 'list', 'ls', 'get', 'set'].includes(t)\n}","tryCatchPattern":null,"preventionTips":["Refresh shell completion after upgrading npm","Restrict programmatic completion candidates to the documented subcommand set","Treat completion errors as warnings, not fatal"],"tags":["completion","access","cli","shell"],"backgroundTag":null,"analyzedSha":"1b2de5e052fc0fb95fd7fb6846dcec4ade598e9e","analyzedAt":"2026-08-13T00:53:24.642Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}