puppetlabs/puppet · error · ArgumentError

No option declarations found while building

Error message

No option declarations found while building

What it means

Error "No option declarations found while building" thrown in puppetlabs/puppet.

Source

Thrown at lib/puppet/interface/option.rb:55

        name = optparse_to_optionname(item)
        if Puppet.settings.include? name then
          raise ArgumentError, _("%{option}: already defined in puppet") % { option: item.inspect }
        end

        dup = dups[name]
        if dup
          raise ArgumentError, _("%{option}: duplicates existing alias %{duplicate} in %{parent}") %
                               { option: item.inspect, duplicate: dup.inspect, parent: @parent }
        else
          dups[name] = item
        end
      else
        raise ArgumentError, _("%{option} is not valid for an option argument") % { option: item.inspect }
      end
    end

    if @optparse.empty? then
      raise ArgumentError, _("No option declarations found while building")
    end

    # Now, infer the name from the options; we prefer the first long option as
    # the name, rather than just the first option.
    @name = optparse_to_name(@optparse.find do |a| a =~ /^--/ end || @optparse.first)
    @aliases = @optparse.map { |o| optparse_to_name(o) }

    # Do we take an argument?  If so, are we consistent about it, because
    # incoherence here makes our life super-difficult, and we can more easily
    # relax this rule later if we find a valid use case for it. --daniel 2011-03-30
    @argument = @optparse.any? { |o| o =~ /[ =]/ }
    if @argument and !@optparse.all? { |o| o =~ /[ =]/ } then
      raise ArgumentError, _("Option %{name} is inconsistent about taking an argument") % { name: @name }
    end

    # Is our argument optional?  The rules about consistency apply here, also,
    # just like they do to taking arguments at all. --daniel 2011-03-30
    @optional_argument = @optparse.any? { |o| o =~ /[ =]\[/ }

View on GitHub (pinned to e227c27540)

When it happens

Trigger: Thrown at lib/puppet/interface/option.rb:55 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21). Data as JSON: /api/errors/4304be30083ccb4c. Report an issue: GitHub.