puppetlabs/puppet · error · ArgumentError
Invalid value %{value}
Error message
Invalid value %{value} What it means
`unless_system_user` on the resources metatype protects users from purging. It accepts true/false (booleans), or an integer/integer-string UID used as the inclusive limit below which users are kept; `true` resolves to Puppet's system_users_max_uid. The munge (lib/puppet/type/resources.rb:60) raises ArgumentError for anything else.
Source
Thrown at lib/puppet/type/resources.rb:60
newparam(:unless_system_user) do
desc "This keeps system users from being purged. By default, it
does not purge users whose UIDs are less than the minimum UID for the system (typically 500 or 1000), but you can specify
a different UID as the inclusive limit."
newvalues(:true, :false, /^\d+$/)
munge do |value|
case value
when /^\d+/
Integer(value)
when :true, true
@resource.class.system_users_max_uid
when :false, false
false
when Integer; value
else
raise ArgumentError, _("Invalid value %{value}") % { value: value.inspect }
end
end
defaultto {
if @resource[:name] == "user"
@resource.class.system_users_max_uid
else
nil
end
}
end
newparam(:unless_uid) do
desc 'This keeps specific uids or ranges of uids from being purged when purge is true.
Accepts integers, integer strings, and arrays of integers or integer strings.
To specify a range of uids, consider using the range() function from stdlib.'
munge do |value|View on GitHub (pinned to e227c27540)
Solutions
- Pass a plain boolean or a single integer/integer-string UID ceiling (e.g. 1000)
- For excluding multiple specific UIDs, use the separate `unless_uid` parameter
- Leave it unset to get the default (system_users_max_uid) when purging users
Example fix
# before
resources { 'user':
purge => true,
unless_system_user => 'system',
}
# after
resources { 'user':
purge => true,
unless_system_user => 1000,
} Defensive patterns
Strategy: validation
Validate before calling
if $unless_system_user != undef and $unless_system_user !~ /^\d+$/ and $unless_system_user !~ /^(true|false)$/ {
fail('unless_system_user must be true, false, or a UID integer')
} Type guard
def valid_unless_system_user?(v) v == true || v == false || v.is_a?(Integer) || v.to_s =~ /^\d+$/ end
Try / catch
begin
Puppet::Type.type(:resources).new(
name: 'user', purge: true, unless_system_user: 'system'
)
rescue ArgumentError => e
raise unless e.message.include?('Invalid value')
# coerce to boolean or integer and retry
end Prevention
- Use booleans or a single integer for UID thresholds
- Use unless_uid (arrays allowed) for exclusions of specific UIDs
- Dry-run purge profiles in a noop compile before production
When it happens
Trigger: `resources { 'user': purge => true, unless_system_user => 'system' }`; floats like 500.5; symbols; ranges or arrays; words like 'none'/'all'.
Common situations: Copy-paste confusion with unless_uid/unless_system_group wording; users trying to pass a UID range or list; assuming named policies are accepted.
Related errors
- Invalid value %{value}.
- Password minimum age must be provided as a number.
- Password maximum age must be provided as a number.
- Invalid hold value %{value}. %{doc}
- You cannot use "mark" property while "ensure" is one of ["ab
AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21).
Data as JSON: /api/errors/93be427b699d18e3.
Report an issue: GitHub.