{"record":{"id":"db2876735d830eb7","repo":"puppetlabs/puppet","slug":"expected-a-hash-with-type-to-format-mappings-got","errorCode":null,"errorMessage":"expected a hash with type to format mappings, got instance of '#{fmt.class}'","messagePattern":"expected a hash with type to format mappings, got instance of '#(.+?)'","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/pops/types/string_converter.rb","lineNumber":539,"sourceCode":"\n  #  # A method only used for manual debugging as the default output of the formatting rules is\n  #  # very hard to read otherwise.\n  #  #\n  #  # @api private\n  #  def dump_string_formats(f, indent = 1)\n  #     return f.to_s unless f.is_a?(Hash)\n  #     \"{#{f.map {|k,v| \"#{k.to_s} => #{dump_string_formats(v,indent+1)}\"}.join(\",\\n#{'  '*indent}  \")}}\"\n  #  end\n\n  def _convert(val_type, value, format_map, indentation)\n    @string_visitor.visit_this_3(self, val_type, value, format_map, indentation)\n  end\n  private :_convert\n\n  def validate_input(fmt)\n    return nil if fmt.nil?\n    unless fmt.is_a?(Hash)\n      raise ArgumentError, \"expected a hash with type to format mappings, got instance of '#{fmt.class}'\"\n    end\n\n    fmt.each_with_object({}) do |entry, result|\n      key, value = entry\n      unless key.is_a?(Types::PAnyType)\n        raise ArgumentError, \"top level keys in the format hash must be data types, got instance of '#{key.class}'\"\n      end\n\n      if value.is_a?(Hash)\n        result[key] = validate_container_input(value)\n      else\n        result[key] = Format.new(value)\n      end\n    end\n  end\n  private :validate_input\n\n  FMT_KEYS = %w[separator separator2 format string_formats].freeze","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/pops/types/string_converter.rb#L521-L557","documentation":"Error \"expected a hash with type to format mappings, got instance of '#{fmt.class}'\" thrown in puppetlabs/puppet.","triggerScenarios":"Thrown at lib/puppet/pops/types/string_converter.rb:539 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}