{"record":{"id":"1a7c16d893bdf713","repo":"puppetlabs/puppet","slug":"parameter-name-argument-must-be-a-symbol-got-na","errorCode":null,"errorMessage":"Parameter name argument must be a Symbol. Got %{name_class}","messagePattern":"Parameter name argument must be a Symbol\\. Got %(.+?)","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/functions.rb","lineNumber":539,"sourceCode":"    #\n    # @api public\n    def return_type(type)\n      unless type.is_a?(String) || type.is_a?(Puppet::Pops::Types::PAnyType)\n        raise ArgumentError, _(\"Argument to 'return_type' must be a String reference to a Puppet Data Type. Got %{type_class}\") % { type_class: type.class }\n      end\n\n      @return_type = type\n    end\n\n    private\n\n    # @api private\n    def internal_param(type, name, repeat = false)\n      raise ArgumentError, _('Parameters cannot be added after a block parameter') unless @block_type.nil?\n      raise ArgumentError, _('Parameters cannot be added after a repeated parameter') if @max == :default\n\n      if name.is_a?(String)\n        raise ArgumentError, _(\"Parameter name argument must be a Symbol. Got %{name_class}\") % { name_class: name.class }\n      end\n\n      if type.is_a?(String) || type.is_a?(Puppet::Pops::Types::PAnyType)\n        @types << type\n        @names << name\n        # mark what should be picked for this position when dispatching\n        if repeat\n          @weaving << -@names.size()\n        else\n          @weaving << @names.size() - 1\n        end\n      else\n        raise ArgumentError, _(\"Parameter 'type' must be a String reference to a Puppet Data Type. Got %{type_class}\") % { type_class: type.class }\n      end\n    end\n\n    # @api private\n    def dispatch(meth_name, argument_mismatch_handler, &block)","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/functions.rb#L521-L557","documentation":"In internal_param, the name argument for param/optional_param/repeated params must be a Symbol. A String name fails the is_a?(String) check and raises this ArgumentError with the offending class. The name is used for error messages and dispatch weaving, and Symbols keep it unambiguous with type strings.","triggerScenarios":"param 'String', 'name' (both arguments quoted), or a name computed at runtime that happens to be a String instead of a Symbol.","commonSituations":"Quoting both arguments by habit; converting signatures from data (for example from a YAML-driven generator) that yields strings for names.","solutions":["Write the name with a leading colon: param 'String', :name.","In generators, call to_sym on the name before passing it.","Adopt a style rule: type on the left quoted, name on the right as a Symbol."],"exampleFix":"# before\n param 'String', 'name'\n\n# after\n param 'String', :name","handlingStrategy":"type-guard","validationCode":"# For generated signatures: coerce before building the dispatch\nnames = names.map(&:to_sym)","typeGuard":"symbol_name = ->(n) { n.is_a?(Symbol) }\nraise ArgumentError, 'names must be Symbols' unless %i[x y].all? { |n| symbol_name.call(n) }","tryCatchPattern":null,"preventionTips":["Quote the type, colon the name: param 'String', :name.","Coerce generated names with to_sym at the source.","Scan dispatch blocks for fully-quoted argument pairs during review."],"tags":["puppet","functions","dispatch","symbol","type-validation"],"backgroundTag":"invalid-parameter-name","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}