puppetlabs/puppet · error · ArgumentError

Cannot disable unrecognized warning types '%{invalid}'. Vali

Error message

Cannot disable unrecognized warning types '%{invalid}'. Valid values are '%{values}'.

What it means

Validation raised by the `:hook` proc for the `disable_warnings` setting in `Puppet::Defaults`. On assignment the munged value list is intersected with the allowlist %w[deprecations undefined_variables undefined_resources]; any leftover token produces this ArgumentError (the message concatenates 'Cannot disable unrecognized warning types' with 'Valid values are'). It fires at configuration parse time, from puppet.conf or from `Puppet[:disable_warnings] = ...` in code, before the run starts.

Source

Thrown at lib/puppet/defaults.rb:157

      :type    => :array,
      :desc    => "A comma-separated list of warning types to suppress. If large numbers
        of warnings are making Puppet's logs too large or difficult to use, you
        can temporarily silence them with this setting.

        If you are preparing to upgrade Puppet to a new major version, you
        should re-enable all warnings for a while.

        Valid values for this setting are:

        * `deprecations` --- disables deprecation warnings.
        * `undefined_variables` --- disables warnings about non existing variables.
        * `undefined_resources` --- disables warnings about non existing resources.",
      :hook      => proc do |value|
        values = munge(value)
        valid   = %w[deprecations undefined_variables undefined_resources]
        invalid = values - (values & valid)
        unless invalid.empty?
          raise ArgumentError, _("Cannot disable unrecognized warning types '%{invalid}'.") % { invalid: invalid.join(',') } +
              ' ' + _("Valid values are '%{values}'.") % { values: valid.join(', ') }
        end
      end
    },
    :skip_logging_catalog_request_destination => {
      :default => false,
      :type    => :boolean,
      :desc => "Specifies whether to suppress the notice of which compiler
        supplied the catalog. A value of `true` suppresses the notice.",
    },
    :merge_dependency_warnings => {
      :default => false,
      :type    => :boolean,
      :desc    => "Whether to merge class-level dependency failure warnings.

        When a class has a failed dependency, every resource in the class
        generates a notice level message about the dependency failure,
        and a warning level message about skipping the resource.

View on GitHub (pinned to e227c27540)

Solutions

  1. Use only: deprecations, undefined_variables, undefined_resources — lowercase, exact, comma-separated
  2. Remove the misspelled token from `disable_warnings` in puppet.conf / PE classifier / hiera-managed config
  3. If a module manages this setting, correct the data source (hiera/profile) that feeds it

Example fix

# before
[main]
disable_warnings = deprecation, legacy_warn
# after
[main]
disable_warnings = deprecations, undefined_variables
Defensive patterns

Strategy: validation

Validate before calling

VALID_WARNINGS = %w[deprecations undefined_variables undefined_resources].freeze
values = raw_setting.split(',').map(&:strip).reject(&:empty?)
invalid = values - VALID_WARNINGS
raise ArgumentError, "unrecognized warning types: #{invalid.join(',')}" unless invalid.empty?
Puppet[:disable_warnings] = values.join(',')

Type guard

def valid_disable_warnings?(raw)
  (raw.to_s.split(',').map(&:strip).reject(&:empty?) - %w[deprecations undefined_variables undefined_resources]).empty?
end

Prevention

When it happens

Trigger: Setting `disable_warnings = deprecation` (singular), `disable_warnings = legacy_stuff`, or any unknown token in puppet.conf or via the settings API; values are matched exactly, so `Deprecations` or `Deprecation` also fail. Note `undefined_resources` only exists in newer Puppet releases.

Common situations: Copy-pasting settings from blog posts or modules targeting a different Puppet version; singular-form typos; configuration management (ini_setting modules, PE console settings) pushing arbitrary strings into this key.

Related errors


AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21). Data as JSON: /api/errors/4ba7d6552bdeb00d. Report an issue: GitHub.