puppetlabs/puppet · error · ArgumentError

Invalid value %{value}: %{property} must be an Integer!

Error message

Invalid value %{value}: %{property} must be an Integer!

What it means

The AIX user/group providers build per-property mappings; numeric properties (uid, gid, pgrp and similar) get a property-to-attribute lambda that accepts only real Integers, raising ArgumentError 'Invalid value X: <property> must be an Integer!' otherwise. AIX itself rejects non-numeric attributes, so Puppet validates early with a clearer message; the property name and the offending value are both included.

Source

Thrown at lib/puppet/provider/aix_object.rb:126

      mappings[:puppet_property][info[:aix_attribute]] = MappedObject.new(
        info[:puppet_property],
        :convert_attribute_value,
        info[:attribute_to_property]
      )
    end

    # Creates a mapping from a purely numeric Puppet property to
    # an attribute
    def numeric_mapping(info = {})
      property = info[:puppet_property]

      # We have this validation here b/c not all numeric properties
      # handle this at the property level (e.g. like the UID). Given
      # that, we might as well go ahead and do this validation for all
      # of our numeric properties. Doesn't hurt.
      info[:property_to_attribute] = lambda do |value|
        unless value.is_a?(Integer)
          raise ArgumentError, _("Invalid value %{value}: %{property} must be an Integer!") % { value: value, property: property }
        end

        value.to_s
      end

      # AIX will do the right validation to ensure numeric attributes
      # can't be set to non-numeric values, so no need for the extra clutter.
      info[:attribute_to_property] = lambda do |value| # rubocop:disable Style/SymbolProc
        value.to_i
      end

      mapping(info)
    end

    #-------------
    # Useful Class Methods
    # ------------

View on GitHub (pinned to e227c27540)

Solutions

  1. Pass an unquoted integer: uid => 1001.
  2. Type the parameter so compilation catches bad shapes: Integer $uid or Optional[Integer].
  3. Convert defensively at the boundary: uid => Integer($uid_string).

Example fix

# before (Puppet DSL)
user { 'build': uid => '1001' }   # ArgumentError on AIX

# after
user { 'build': uid => 1001 }     # and in the class signature: Optional[Integer] $uid = undef
Defensive patterns

Strategy: validation

Validate before calling

# Ruby
fail 'uid must be an Integer' unless uid.is_a?(Integer)

# Puppet DSL: constrain the parameter
Optional[Integer] $uid = undef

Type guard

def aix_numeric?(v)
  v.is_a?(Integer)
end

Prevention

When it happens

Trigger: user { 'build': uid => '1001' } (quoted string) on AIX; Hiera YAML storing uid/gid as quoted strings; passing a Float or nil for a numeric AIX attribute.

Common situations: Manifests or Hiera authored on Linux where other providers tolerate strings; templating that quotes every value; module parameters left untyped so strings flow through.

Related errors


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