{"record":{"id":"1e3d6eefe06805ac","repo":"puppetlabs/puppet","slug":"illegal-format-actual-specified-for-value-of-1e3d6e","errorCode":null,"errorMessage":"Illegal format '#{actual}' specified for value of Integer type - expected one of the characters 'dxXobBeEfgGaAspc'","messagePattern":"Illegal format '#(.+?)' specified for value of Integer type - expected one of the characters 'dxXobBeEfgGaAspc'","errorType":"validation","errorClass":"Puppet::Pops::Types::StringConverter::FormatError","httpStatus":null,"severity":"error","filePath":"lib/puppet/pops/types/string_converter.rb","lineNumber":749,"sourceCode":"    case f.format\n    when :d, :x, :X, :o, :b, :B, :p\n      Kernel.format(f.orig_fmt, val)\n\n    when :e, :E, :f, :g, :G, :a, :A\n      Kernel.format(f.orig_fmt, val.to_f)\n\n    when :c\n      char = [val].pack(\"U\")\n      char = f.alt? ? \"\\\"#{char}\\\"\" : char\n      Kernel.format(f.orig_fmt.tr('c', 's'), char)\n\n    when :s\n      fmt = f.alt? ? 'p' : 's'\n      int_str = Kernel.format('%d', val)\n      Kernel.format(f.orig_fmt.gsub('s', fmt), int_str)\n\n    else\n      raise FormatError.new('Integer', f.format, 'dxXobBeEfgGaAspc')\n    end\n  end\n\n  # @api private\n  def string_PFloatType(val_type, val, format_map, _)\n    f = get_format(val_type, format_map)\n    case f.format\n    when :d, :x, :X, :o, :b, :B\n      Kernel.format(f.orig_fmt, val.to_i)\n\n    when :e, :E, :f, :g, :G, :a, :A, :p\n      Kernel.format(f.orig_fmt, val)\n\n    when :s\n      float_str = f.alt? ? \"\\\"#{Kernel.format('%p', val)}\\\"\" : Kernel.format('%p', val)\n      Kernel.format(f.orig_fmt, float_str)\n\n    else","sourceCodeStart":731,"sourceCodeEnd":767,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/pops/types/string_converter.rb#L731-L767","documentation":"StringConverter raises this FormatError when formatting an Integer with a conversion letter outside 'dxXobBeEfgGaAspc'. Integers accept numeric radix and float letters (dxXobBeEfgGaA), string/inspect forms (s/p) and character output (c). Any other letter — notably '%v' (n/a, only legal for Undef) or '%t' — falls through to the else at string_converter.rb:749 and raises FormatError('Integer', f.format, 'dxXobBeEfgGaAspc').","triggerScenarios":"`String(42, '%v')`, `String($count, '%t')`, `String(10, '%q')` — conversion letter not in the allowed set. Frequently hit by passing a full printf spec meant for sprintf into String() where the letter must match the value's Puppet type.","commonSituations":"Copy-pasting sprintf format strings between contexts; formatting mixed-type structure values with one shared format; data-driven format strings from Hiera containing a letter valid for a different type.","solutions":["Use '%d' (decimal), '%x'/'%o'/'%b' (radix), '%e'/'%f'/'%g' (float forms) or '%s' for integers","If you want sprintf semantics, call sprintf() directly instead of String(value, fmt)","Validate dynamic format letters against %w[d x X o b B e E f g G a A s p c]"],"exampleFix":"# before\n$str = String($count, '%v')\n# after\n$str = String($count, '%d')","handlingStrategy":"validation","validationCode":"fmt = '%v'\nletter = fmt[/\\A%[#\\-+ 0\\d.]*([a-zA-Z])\\z/, 1]\nraise ArgumentError, \"#{fmt} invalid for Integer\" unless %w[d x X o b B e E f g G a A s p c].include?(letter)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default to %d for integers; use sprintf() when you want full printf semantics","Keep per-type format maps instead of a single shared format string","Reject %v/%t style letters from external format sources for numeric fields"],"tags":["puppet","pops","string-conversion","format-error","integer"],"backgroundTag":"invalid-format-specifier","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}