puppetlabs/puppet · error · Puppet::ParseError

# : #

Error message

#{subject}:
 #{errors_str}

What it means

Parameter validation failed for multiple parameters; all mismatch descriptions are joined and raised together after the subject string.

Solutions

  1. Correct each listed parameter value to match its declared type
  2. Relax the parameter types in the Struct if the values are acceptable
  3. Address errors in order; the message lists every offending parameter
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

    # with the corresponding param_struct element and that all required values are provided.
    #
    # @param subject [String] string to be prepended to the exception message
    # @param params_struct [PStructType] Struct to use for validation
    # @param given_hash [Hash<String,Object>] the parameters to validate
    # @param missing_ok [Boolean] Do not generate errors on missing parameters
    # @param tense [Symbol] deprecated and ignored
    #
    def validate_parameters(subject, params_struct, given_hash, missing_ok = false, tense = :ignored)
      tense_deprecated unless tense == :ignored
      errors = describe_struct_signature(params_struct, given_hash, missing_ok).flatten
      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

    # Describe a confirmed mismatch using present tense
    #
    # @param name [String] name of mismatch
    # @param expected [PAnyType] expected type
    # @param actual [PAnyType] actual type
    # @param tense [Symbol] deprecated and ignored
    #
    def describe_mismatch(name, expected, actual, tense = :ignored)
      tense_deprecated unless tense == :ignored
      errors = describe(expected, actual, [SubjectPathElement.new(name)])
      case errors.size
      when 0
        ''
      when 1
        errors[0].format.strip

View on GitHub (pinned to e227c27540)