{"record":{"id":"c69d347168e15224","repo":"puppetlabs/puppet","slug":"option-is-not-valid-for-an-option-argument","errorCode":null,"errorMessage":"%{option} is not valid for an option argument","messagePattern":"%(.+?) is not valid for an option argument","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/interface/option.rb","lineNumber":50,"sourceCode":"        # faces for dns alt names. Puppet defines 'dns_alt_names', those\n        # faces include 'dns-alt-names'.  We can't get rid of 'dns-alt-names'\n        # yet, so we need to do our duplicate checking on the untranslated\n        # version of the option.\n        # jeffweiss 17 april 2012\n        name = optparse_to_optionname(item)\n        if Puppet.settings.include? name then\n          raise ArgumentError, _(\"%{option}: already defined in puppet\") % { option: item.inspect }\n        end\n\n        dup = dups[name]\n        if dup\n          raise ArgumentError, _(\"%{option}: duplicates existing alias %{duplicate} in %{parent}\") %\n                               { option: item.inspect, duplicate: dup.inspect, parent: @parent }\n        else\n          dups[name] = item\n        end\n      else\n        raise ArgumentError, _(\"%{option} is not valid for an option argument\") % { option: item.inspect }\n      end\n    end\n\n    if @optparse.empty? then\n      raise ArgumentError, _(\"No option declarations found while building\")\n    end\n\n    # Now, infer the name from the options; we prefer the first long option as\n    # the name, rather than just the first option.\n    @name = optparse_to_name(@optparse.find do |a| a =~ /^--/ end || @optparse.first)\n    @aliases = @optparse.map { |o| optparse_to_name(o) }\n\n    # Do we take an argument?  If so, are we consistent about it, because\n    # incoherence here makes our life super-difficult, and we can more easily\n    # relax this rule later if we find a valid use case for it. --daniel 2011-03-30\n    @argument = @optparse.any? { |o| o =~ /[ =]/ }\n    if @argument and !@optparse.all? { |o| o =~ /[ =]/ } then\n      raise ArgumentError, _(\"Option %{name} is inconsistent about taking an argument\") % { name: @name }","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/interface/option.rb#L32-L68","documentation":"Error \"%{option} is not valid for an option argument\" thrown in puppetlabs/puppet.","triggerScenarios":"Thrown at lib/puppet/interface/option.rb:50 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}