{"record":{"id":"4304be30083ccb4c","repo":"puppetlabs/puppet","slug":"no-option-declarations-found-while-building","errorCode":null,"errorMessage":"No option declarations found while building","messagePattern":"No option declarations found while building","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/interface/option.rb","lineNumber":55,"sourceCode":"        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 }\n    end\n\n    # Is our argument optional?  The rules about consistency apply here, also,\n    # just like they do to taking arguments at all. --daniel 2011-03-30\n    @optional_argument = @optparse.any? { |o| o =~ /[ =]\\[/ }","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/interface/option.rb#L37-L73","documentation":"Error \"No option declarations found while building\" thrown in puppetlabs/puppet.","triggerScenarios":"Thrown at lib/puppet/interface/option.rb:55 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"}