puppetlabs/puppet · error · ArgumentError

No matching arity found for #

Error message

No matching arity found for #{func.class.name} with arguments #{value.arguments}

What it means

A deferred function's return type could not be checked because the function implementation accepts no arity matching the given arguments, so its result type is undeterminable.

Solutions

  1. Match the number of arguments to one of the function's callable signatures
  2. Define the function with a signature that accepts the given arguments
  3. Fix the function dispatch in its puppet function definition
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/puppet/pops/types/type_mismatch_describer.rb:589 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/d07b4f732ef4c3f2. Report an issue: GitHub.

Appendix: source

Thrown at lib/puppet/pops/types/type_mismatch_describer.rb:589

      unless param_type.instance?(value)
        errors = describe(param_type, TypeCalculator.singleton.infer_set(value).generalize, [ParameterPathElement.new(param_name)])
        case errors.size
        when 0
          # do nothing
        when 1
          raise Puppet::ParseError, "#{subject}:#{errors[0].format}"
        else
          errors_str = errors.map(&:format).join("\n ")
          raise Puppet::ParseError, "#{subject}:\n #{errors_str}"
        end
      end
    end

    def get_deferred_function_return_type(value)
      func = Puppet.lookup(:loaders).private_environment_loader
                   .load(:function, value.name)
      dispatcher = func.class.dispatcher.find_matching_dispatcher(value.arguments)
      raise ArgumentError, "No matching arity found for #{func.class.name} with arguments #{value.arguments}" unless dispatcher

      dispatcher.type.return_type
    end
    private :get_deferred_function_return_type

    # Validates that all entries in the _param_hash_ exists in the given param_struct, that their type conforms
    # with the corresponding param_struct element and that all required values are provided.
    # An error message is created for each problem found.
    #
    # @param params_struct [PStructType] Struct to use for validation
    # @param param_hash [Hash<String,Object>] The parameters to validate
    # @param missing_ok [Boolean] Do not generate errors on missing parameters
    # @return [Array<Mismatch>] An array of found errors. An empty array indicates no errors.
    def describe_struct_signature(params_struct, param_hash, missing_ok = false)
      param_type_hash = params_struct.hashed_elements
      result = param_hash.each_key.reject { |name| param_type_hash.include?(name) }.map { |name| InvalidParameter.new(nil, name) }

      params_struct.elements.each do |elem|

View on GitHub (pinned to e227c27540)