{"record":{"id":"fc05b98a52e639af","repo":"puppetlabs/puppet","slug":"can-t-find-a-name-in-the-declaration-declaration","errorCode":null,"errorMessage":"Can't find a name in the declaration %{declaration}","messagePattern":"Can't find a name in the declaration %(.+?)","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/interface/option.rb","lineNumber":94,"sourceCode":"    end\n    if @optional_argument and !@optparse.all? { |o| o =~ /[ =]\\[/ } then\n      raise ArgumentError, _(\"Option %{name} is inconsistent about the argument being optional\") % { name: @name }\n    end\n  end\n\n  # to_s and optparse_to_name are roughly mirrored, because they are used to\n  # transform options to name symbols, and vice-versa.  This isn't a full\n  # bidirectional transformation though. --daniel 2011-04-07\n\n  def to_s\n    @name.to_s.tr('_', '-')\n  end\n\n  # @api private\n  def optparse_to_optionname(declaration)\n    found = declaration.match(/^-+(?:\\[no-\\])?([^ =]+)/)\n    unless found\n      raise ArgumentError, _(\"Can't find a name in the declaration %{declaration}\") % { declaration: declaration.inspect }\n    end\n\n    found.captures.first\n  end\n\n  # @api private\n  def optparse_to_name(declaration)\n    name = optparse_to_optionname(declaration).tr('-', '_')\n    unless name.to_s =~ /^[a-z]\\w*$/\n      raise _(\"%{name} is an invalid option name\") % { name: name.inspect }\n    end\n\n    name.to_sym\n  end\n\n  def takes_argument?\n    !!@argument\n  end","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/interface/option.rb#L76-L112","documentation":"Error \"Can't find a name in the declaration %{declaration}\" thrown in puppetlabs/puppet.","triggerScenarios":"Thrown at lib/puppet/interface/option.rb:94 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"}