puppetlabs/puppet · error · Puppet::ParseError

Invalid number of type parameters specified

Error message

Invalid number of type parameters specified: %{type} requires %{required}, %{given} provided

What it means

Generic arity guard for parameterized type references: the number of parameters between the brackets does not match what the named type requires.

Solutions

  1. Match the parameter count to the type's requirements (e.g. Regexp takes 1, Resource 1 or 2)
  2. Remove extra or add missing parameters in the access expression
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/puppet/pops/types/type_parser.rb:673 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/2bd7a69f7fa1c03f. Report an issue: GitHub.

Appendix: source

Thrown at lib/puppet/pops/types/type_parser.rb:673

    end
  end

  def assert_type(ast, t)
    raise_invalid_type_specification_error(ast) unless t.is_a?(PAnyType)
    t
  end

  def assert_range_parameter(ast, t)
    raise_invalid_type_specification_error(ast) unless TypeFactory.is_range_parameter?(t)
  end

  def raise_invalid_type_specification_error(ast)
    raise Puppet::ParseError, _("The expression <%{expression}> is not a valid type specification.") %
                              { expression: original_text_of(ast) }
  end

  def raise_invalid_parameters_error(type, required, given)
    raise Puppet::ParseError, _("Invalid number of type parameters specified: %{type} requires %{required}, %{given} provided") %
                              { type: type, required: required, given: given }
  end

  def raise_unparameterized_type_error(ast)
    raise Puppet::ParseError, _("Not a parameterized type <%{type}>") % { type: original_text_of(ast) }
  end

  def raise_unknown_type_error(ast)
    raise Puppet::ParseError, _("Unknown type <%{type}>") % { type: original_text_of(ast) }
  end

  def original_text_of(ast)
    ast.locator.extract_tree_text(ast)
  end
end
end
end

View on GitHub (pinned to e227c27540)