puppetlabs/puppet · error · Puppet::ParseError

# :#

Error message

#{subject}:#{errors[0].format}

What it means

Parameter validation failed for exactly one parameter; the single mismatch description is appended to the subject string and raised as a ParseError.

Solutions

  1. Fix the reported parameter value so it conforms to the declared parameter type
  2. Adjust the parameter's type in the Struct definition if the value is legitimate
Defensive patterns

Strategy: validation

When it happens

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

Appendix: source

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

    end

    # Validates that all entries in the give_hash exists in the given param_struct, that their type conforms
    # 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

View on GitHub (pinned to e227c27540)