{"record":{"id":"4dfe8df2fb86973b","repo":"puppetlabs/puppet","slug":"param-is-a-metaparameter-please-choose-another","errorCode":null,"errorMessage":"%{param} is a metaparameter; please choose another parameter name in the %{name} definition","messagePattern":"%(.+?) is a metaparameter; please choose another parameter name in the %(.+?) definition","errorType":"exception","errorClass":"Puppet::ParseError","httpStatus":null,"severity":"error","filePath":"lib/puppet/resource/type.rb","lineNumber":420,"sourceCode":"      @name = name\n      @namespace = \"\"\n    else\n      @name = name.to_s.downcase\n\n      # Note we're doing something somewhat weird here -- we're setting\n      # the class's namespace to its fully qualified name.  This means\n      # anything inside that class starts looking in that namespace first.\n      @namespace, _ = @type == :hostclass ? [@name, ''] : namesplit(@name)\n    end\n  end\n\n  def warn_if_metaparam(param, default)\n    return unless Puppet::Type.metaparamclass(param)\n\n    if default\n      warnonce _(\"%{param} is a metaparam; this value will inherit to all contained resources in the %{name} definition\") % { param: param, name: name }\n    else\n      raise Puppet::ParseError, _(\"%{param} is a metaparameter; please choose another parameter name in the %{name} definition\") % { param: param, name: name }\n    end\n  end\n\n  def parameter_struct\n    @parameter_struct ||= create_params_struct\n  end\n\n  def create_params_struct\n    arg_types = argument_types\n    type_factory = Puppet::Pops::Types::TypeFactory\n    members = { type_factory.optional(type_factory.string(NAME)) => type_factory.any }\n\n    Puppet::Type.eachmetaparam do |name|\n      # TODO: Once meta parameters are typed, this should change to reflect that type\n      members[name.to_s] = type_factory.any\n    end\n\n    arguments.each_pair do |name, default|","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/resource/type.rb#L402-L438","documentation":"Puppet::Resource::Type#warn_if_metaparam fires when a class or defined type declares a parameter whose name is a metaparameter (require, before, notify, subscribe, audit, loglevel, alias, tag, schedule, stage...). With a default value it only emits a warning (the value would inherit into all contained resources); without a default value it raises Puppet::ParseError, because the metaparam semantics would silently shadow user intent.","triggerScenarios":"Writing `define monitor::check($service_name, $notify)` (no default) — raises; `define apache::vhost($port, $require = undef)` — warns because every contained resource inheriting $require changes behavior. The check runs when the definition's parameter list is processed (Puppet::Type.metaparamclass(param) is truthy).","commonSituations":"Older or third-party modules that predate the check using parameters like $require or $notify; API-natural names colliding with metaparams ($alias, $tag); Puppet upgrades that made this stricter failing previously-working modules.","solutions":["Rename the parameter to a non-metaparam name: $require -> $requires or $pkg_to_require, $notify -> $notify_service, $alias -> $aka.","If the parameter must keep its name for API compatibility, give it a default value (only a warning is emitted) and internally use the parameter explicitly rather than relying on inheritance.","Audit parameter lists of your modules against Puppet::Type metaparam names and fix all collisions at once."],"exampleFix":"# before\ndefine monitor::service($service_name, $notify) {\n  service { $service_name:\n    ensure => running,\n  }\n}\n\n# after\ndefine monitor::service($service_name, $notify_service = undef) {\n  service { $service_name:\n    ensure  => running,\n    notify  => $notify_service,\n  }\n}","handlingStrategy":"validation","validationCode":"# reject parameter names that collide with metaparameters before defining types\nMETAPARAMS = Puppet::Type.alltypes.flat_map { |t| t.metaparams }.uniq.map(&:to_s)\nparams.each do |p|\n  raise ArgumentError, \"parameter #{p} collides with a metaparameter\" if METAPARAMS.include?(p.to_s)\nend","typeGuard":"safe_param_name = ->(name) { Puppet::Type.metaparamclass(name.to_sym).nil? }","tryCatchPattern":"begin\n  # load the definition / compile the manifest\nrescue Puppet::ParseError => e\n  raise unless e.message.include?('is a metaparameter')\n  Puppet.err(\"rename the parameter named in: #{e.message}\")\n  raise\nend","preventionTips":["Never name class/defined-type parameters require, before, notify, subscribe, audit, loglevel, alias, tag, schedule, or stage","If a colliding name is part of a public module API, give it a default value (downgrades to a warning) and migrate users","Grep module parameter lists for metaparam names during upgrades"],"tags":["puppet","metaparameter","parse-error","defined-type","dsl"],"backgroundTag":"parameter-name-collision","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}