{"record":{"id":"bf7e0ae3c1459f15","repo":"puppetlabs/puppet","slug":"invalid-duration-format-value-for-parameter","errorCode":null,"errorMessage":"Invalid duration format '%{value}' for parameter: %{name}","messagePattern":"Invalid duration format '%(.+?)' for parameter: %(.+?)","errorType":"validation","errorClass":"Puppet::Settings::ValidationError","httpStatus":null,"severity":"error","filePath":"lib/puppet/settings/duration_setting.rb","lineNumber":30,"sourceCode":"    \"m\" => 60,\n    \"s\" => 1\n  }\n\n  # A regex describing valid formats with groups for capturing the value and units\n  FORMAT = /^(\\d+)(y|d|h|m|s)?$/\n\n  def type\n    :duration\n  end\n\n  # Convert the value to an integer, parsing numeric string with units if necessary.\n  def munge(value)\n    if value.is_a?(Integer) || value.nil?\n      value\n    elsif value.is_a?(String) and value =~ FORMAT\n      ::Regexp.last_match(1).to_i * UNITMAP[::Regexp.last_match(2) || 's']\n    else\n      raise Puppet::Settings::ValidationError, _(\"Invalid duration format '%{value}' for parameter: %{name}\") % { value: value.inspect, name: @name }\n    end\n  end\nend\n","sourceCodeStart":12,"sourceCodeEnd":34,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/settings/duration_setting.rb#L12-L34","documentation":"Puppet::Settings::DurationSetting#munge converts duration settings (runinterval, http_keepalive_timeout, ...) to seconds. Accepted inputs are Integers/nil or Strings matching ^(\\d+)(y|d|h|m|s)?$ — a number plus at most ONE single-letter unit. Multi-unit strings (1h30m), decimals (1.5h), negatives, spaces (90 s), or long unit names (10minutes, 5min, 500ms) raise Puppet::Settings::ValidationError.","triggerScenarios":"puppet.conf `runinterval = 10minutes`, `runinterval = 1.5h`, `runinterval = 1h30m`, or `runinterval = 500ms`; programmatic Puppet.settings[:runinterval] = '90 s'; values copied from systemd/nginx configs.","commonSituations":"Expecting millisecond support (the smallest unit is s); copying time formats across tools; templated configs generating compound durations.","solutions":["Use a bare integer of seconds (runinterval = 600) or number + single letter: 10m, 2h, 1d, 1y.","Convert compound durations yourself before writing config (1h30m -> 90m or 5400).","Milliseconds are not supported — convert ms values to seconds (500ms -> 0.5 is invalid; use 1 or restructure)."],"exampleFix":"# before (puppet.conf [agent])\nruninterval = 10minutes\n\n# after\nruninterval = 10m","handlingStrategy":"validation","validationCode":"raise ArgumentError, \"bad duration #{v.inspect}\" unless v.is_a?(Integer) || v.to_s.match?(/^(\\d+)(y|d|h|m|s)?$/)\nPuppet.settings[:runinterval] = v","typeGuard":"valid_duration = ->(v) { v.is_a?(Integer) || v.to_s.match?(/^(\\d+)(y|d|h|m|s)?$/) }","tryCatchPattern":"begin\n  Puppet.settings[:runinterval] = v\nrescue Puppet::Settings::ValidationError => e\n  raise unless e.message.include?('duration')\n  Puppet.err(\"#{e.message} — use integer seconds or Ns/Nm/Nh/Nd/Ny\")\n  raise\nend","preventionTips":["Use bare seconds (600) or one single-letter unit (10m, 2h, 1d)","No milliseconds, decimals, negatives, or compound units (1h30m) in duration settings","Convert systemd/nginx-style durations before writing them into puppet.conf"],"tags":["puppet","settings","duration","runinterval","validation-error"],"backgroundTag":"invalid-duration-format","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}