{"record":{"id":"4cc5cf18572a5357","repo":"puppetlabs/puppet","slug":"illegal-format-actual-specified-for-value-of-4cc5cf","errorCode":null,"errorMessage":"Illegal format '#{actual}' specified for value of Type type - expected one of the characters 'sp'","messagePattern":"Illegal format '#(.+?)' specified for value of Type type - expected one of the characters 'sp'","errorType":"validation","errorClass":"Puppet::Pops::Types::StringConverter::FormatError","httpStatus":null,"severity":"error","filePath":"lib/puppet/pops/types/string_converter.rb","lineNumber":1113,"sourceCode":"    end\n  end\n\n  # @api private\n  def string_PStructType(val_type, val, format_map, indentation)\n    string_PHashType(val_type, val, format_map, indentation)\n  end\n\n  # @api private\n  def string_PTypeType(val_type, val, format_map, _)\n    f = get_format(val_type, format_map)\n    case f.format\n    when :s\n      str_val = f.alt? ? \"\\\"#{val}\\\"\" : val.to_s\n      Kernel.format(f.orig_fmt, str_val)\n    when :p\n      Kernel.format(f.orig_fmt.tr('p', 's'), val.to_s)\n    else\n      raise FormatError.new('Type', f.format, 'sp')\n    end\n  end\n\n  # @api private\n  def string_PURIType(val_type, val, format_map, indentation)\n    f = get_format(val_type, format_map)\n    case f.format\n    when :p\n      fmt = TypeFormatter.singleton\n      indentation = indentation.indenting(f.alt? || indentation.is_indenting?)\n      fmt = fmt.indented(indentation.level, 2) if indentation.is_indenting?\n      fmt.string(val)\n    when :s\n      str_val = val.to_s\n      Kernel.format(f.orig_fmt, f.alt? ? puppet_quote(str_val) : str_val)\n    else\n      raise FormatError.new('URI', f.format, 'sp')\n    end","sourceCodeStart":1095,"sourceCodeEnd":1131,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/pops/types/string_converter.rb#L1095-L1131","documentation":"StringConverter raises this FormatError when formatting a Type value (PTypeType — the value itself is a type like Integer[0,10]) with a conversion letter other than 's' (type's string form, quoted with alt flag) or 'p' (same via Kernel.format). The else at string_converter.rb:1113 raises FormatError('Type', f.format, 'sp'). Types stringify to their notation (e.g. 'Integer[0, 10]') and support no other conversions.","triggerScenarios":"`String(Integer, '%d')`, `String($type_var, '%q')` — any letter except s/p applied to a value whose inferred type is Type[...]; common when echoing parameter types in error messages or generated docs.","commonSituations":"Building validation error text that interpolates the expected type with a generic formatter; debug output walking heterogeneous data that includes type objects.","solutions":["Use '%s' or '%p' when stringifying a Type value","If you need the inner type's features, extract and format its parameters instead of the type itself","Whitelist dynamic format letters against %w[s p]"],"exampleFix":"# before\n$str = String($type, '%d')\n# after\n$str = String($type, '%s')","handlingStrategy":"validation","validationCode":"fmt = '%d'\nletter = fmt[/\\A%[#\\-+ 0\\d.]*([a-zA-Z])\\z/, 1]\nraise ArgumentError, \"#{fmt} invalid for Type values\" unless %w[s p].include?(letter)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only %s and %p render Type values","When generating messages about types, interpolate with String($type, '%p')","Keep type objects out of data destined for numeric/other formatting"],"tags":["puppet","pops","string-conversion","format-error","type-type"],"backgroundTag":"invalid-format-specifier","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}