puppetlabs/puppet · error · ArgumentError

Can't find a name in the declaration %{declaration}

Error message

Can't find a name in the declaration %{declaration}

What it means

Error "Can't find a name in the declaration %{declaration}" thrown in puppetlabs/puppet.

Source

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

    end
    if @optional_argument and !@optparse.all? { |o| o =~ /[ =]\[/ } then
      raise ArgumentError, _("Option %{name} is inconsistent about the argument being optional") % { name: @name }
    end
  end

  # to_s and optparse_to_name are roughly mirrored, because they are used to
  # transform options to name symbols, and vice-versa.  This isn't a full
  # bidirectional transformation though. --daniel 2011-04-07

  def to_s
    @name.to_s.tr('_', '-')
  end

  # @api private
  def optparse_to_optionname(declaration)
    found = declaration.match(/^-+(?:\[no-\])?([^ =]+)/)
    unless found
      raise ArgumentError, _("Can't find a name in the declaration %{declaration}") % { declaration: declaration.inspect }
    end

    found.captures.first
  end

  # @api private
  def optparse_to_name(declaration)
    name = optparse_to_optionname(declaration).tr('-', '_')
    unless name.to_s =~ /^[a-z]\w*$/
      raise _("%{name} is an invalid option name") % { name: name.inspect }
    end

    name.to_sym
  end

  def takes_argument?
    !!@argument
  end

View on GitHub (pinned to e227c27540)

When it happens

Trigger: Thrown at lib/puppet/interface/option.rb:94 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/fc05b98a52e639af. Report an issue: GitHub.