{"record":{"id":"fd618553b2fd4f43","repo":"puppetlabs/puppet","slug":"supplying-a-version-only-makes-sense-when-a-fa","errorCode":null,"errorMessage":"Supplying a '--version' only makes sense when a Faces subcommand is given","messagePattern":"Supplying a '--version' only makes sense when a Faces subcommand is given","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/face/help.rb","lineNumber":54,"sourceCode":"      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\n        # legacy apps already emit ronn output\n        return render_application_help(facename)\n      elsif options[:ronn]\n        render_face_man(facename || :help)\n      # Calling `puppet help <app> --ronn` normally calls this action with\n      # <app> as the first argument in the `args` array. However, if <app>\n      # happens to match the name of an action, like `puppet help help\n      # --ronn`, then face_base \"eats\" the argument and `args` will be","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/face/help.rb#L36-L72","documentation":"Usage guard in the `help` face for `--version`: the option selects which version of a Faces subcommand's help to render, so it only makes sense together with a subcommand. Per the code it fires when `--version` was supplied, its value matched `current` case-insensitively, and no positional subcommand argument was given — i.e. `puppet help --version current` with nothing else. Note this is help-rendering version selection; printing Puppet's own version is `puppet --version`.","triggerScenarios":"`puppet help --version current` with no subcommand; wrappers that unconditionally inject `--version <%= v %>` into every `puppet help` invocation, including global help.","commonSituations":"Templated help commands in scripts; misunderstanding `--version` here as a way to print Puppet's version; tab-completed leftovers from an older CLI.","solutions":["Add the subcommand: `puppet help apply --version current`","Or drop the flag: `puppet help`","For Puppet's own version use `puppet --version`, not `puppet help --version`"],"exampleFix":"# before\npuppet help --version current\n# after\npuppet help apply --version current\n# or\npuppet --version","handlingStrategy":"validation","validationCode":"abort '--version requires a subcommand' if options.key?(:version) && args.empty?","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only pass --version to `puppet help` together with a subcommand","Use `puppet --version` to print Puppet's version","Condition template-based help commands on a subcommand being present"],"tags":["puppet-help","cli","usage","version-flag"],"backgroundTag":"invalid-cli-usage","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}