{"record":{"id":"0709e0a567d8c0f9","repo":"puppetlabs/puppet","slug":"the-puppet-help-command-takes-two-optional-arg","errorCode":null,"errorMessage":"The 'puppet help' command takes two (optional) arguments: a subcommand and an action","messagePattern":"The 'puppet help' command takes two \\(optional\\) arguments: a subcommand and an action","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/face/help.rb","lineNumber":46,"sourceCode":"\n    option \"--ronn\" do\n      summary _(\"Whether to render the help text in ronn format.\")\n      default_to { false }\n    end\n\n    default\n    when_invoked do |*args|\n      options = args.pop\n\n      unless options[:ronn]\n        if default_case?(args) || help_for_help?(args)\n          return erb('global.erb').result(binding)\n        end\n      end\n\n      if args.length > 2\n        # TRANSLATORS 'puppet help' is a command line and should not be translated\n        raise ArgumentError, _(\"The 'puppet help' command takes two (optional) arguments: a subcommand and an action\")\n      end\n\n      version = :current\n      if options.has_key? :version\n        if options[:version].to_s !~ /^current$/i\n          version = options[:version]\n        elsif args.length == 0\n          raise ArgumentError, _(\"Supplying a '--version' only makes sense when a Faces subcommand is given\")\n          # TRANSLATORS '--version' is a command line option and should not be translated\n        end\n      end\n\n      facename, actionname = args\n      if legacy_applications.include? facename\n        if actionname\n          raise ArgumentError, _(\"The legacy subcommand '%{sub_command}' does not support supplying an action\") % { sub_command: facename }\n        end\n","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/face/help.rb#L28-L64","documentation":"Usage guard in the `help` face: `puppet help` accepts at most two positional arguments — a subcommand and an action, both optional. Once past the default-case and help-for-help branches, `args.length > 2` raises this ArgumentError before any help text is rendered.","triggerScenarios":"`puppet help apply action extra`, `puppet help module list extra`; passing flags after the action without a separating `--` so they are counted as positionals.","commonSituations":"Pasting a full command line after `puppet help`; scripts that concatenate a variable argument list onto `puppet help`; users expecting `puppet help` to forward options to the subcommand.","solutions":["Give at most a subcommand and an action: `puppet help module list`","For global usage run plain `puppet help`","Constrain wrappers to pass at most two positional tokens to `puppet help`"],"exampleFix":"# before\npuppet help puppet apply --verbose\n# after\npuppet help apply","handlingStrategy":"validation","validationCode":"abort 'puppet help takes at most two arguments (subcommand [action])' if args.length > 2","typeGuard":"def valid_help_args?(args)\n  args.length <= 2\nend","tryCatchPattern":null,"preventionTips":["Pass only the subcommand (and optionally the action) after `puppet help`","Keep wrapper templates from appending extra flags/tokens to help invocations"],"tags":["puppet-help","cli","usage","argumenterror"],"backgroundTag":"invalid-cli-usage","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}