puppetlabs/puppet · error · ArgumentError

Invalid minute '%{n}'

Error message

Invalid minute '%{n}'

What it means

The schedule `range` parser validates each endpoint's minute field: if present it must be 0–59 or ArgumentError "Invalid minute" is raised (lib/puppet/type/schedule.rb:135). Minutes default to 0 when omitted (e.g. '2-5' has no minutes), so the error requires an explicit out-of-range minute.

Source

Thrown at lib/puppet/type/schedule.rb:135

          value.split(/\s*-\s*/).each { |val|
            # Add the values as an array.
            range << val.split(":").collect(&:to_i)
          }

          self.fail _("Invalid range %{value}") % { value: value } if range.length != 2

          # Fill out 0s for unspecified minutes and seconds
          range.each do |time_array|
            (3 - time_array.length).times { |_| time_array << 0 }
          end

          # Make sure the hours are valid
          [range[0][0], range[1][0]].each do |n|
            raise ArgumentError, _("Invalid hour '%{n}'") % { n: n } if n < 0 or n > 23
          end

          [range[0][1], range[1][1]].each do |n|
            raise ArgumentError, _("Invalid minute '%{n}'") % { n: n } if n and (n < 0 or n > 59)
          end
          ret << range
        }

        # Now our array of arrays
        ret
      end

      def weekday_match?(day)
        if @resource[:weekday]
          @resource[:weekday].has_key?(day)
        else
          true
        end
      end

      def match?(previous, now)
        # The lowest-level array is of the hour, minute, second triad

View on GitHub (pinned to e227c27540)

Solutions

  1. Fix the minute value to 0–59
  2. Normalize generated times (roll overflow minutes into hours) in the code producing the range
  3. Omit minutes entirely if you only need whole hours ('2-5')

Example fix

# before
schedule { 'reports':
  range => '9:60-10:30',
}

# after
schedule { 'reports':
  range => '10:00-10:30',
}
Defensive patterns

Strategy: validation

Validate before calling

[$start_min, $end_min].all |Integer $m| { $m >= 0 and $m <= 59 } or
fail('schedule range minutes must be 0-59')

Type guard

def valid_minutes?(start_m, end_m)
  [start_m, end_m].all? { |m| m.is_a?(Integer) && m.between?(0, 59) }
end

Try / catch

begin
  Puppet::Type.type(:schedule).new(name: 'm', range: '9:60-10:30')
rescue ArgumentError => e
  raise unless e.message.include?("Invalid minute")
  # normalize minutes and rebuild
end

Prevention

When it happens

Trigger: `schedule { 'm': range => '9:60-10:30' }`; `range => '17:99-18'`; template arithmetic that carries 60 minutes instead of rolling the hour.

Common situations: Time math bugs where minute overflow (60+) wasn't normalized; hand-edited windows; '17:75' typos.

Related errors


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