{"record":{"id":"220706d166cdd5d3","repo":"puppetlabs/puppet","slug":"invalid-record-type-record-type","errorCode":null,"errorMessage":"Invalid record type %{record_type}","messagePattern":"Invalid record type %(.+?)","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/puppet/util/fileparsing.rb","lineNumber":66,"sourceCode":"      end\n    end\n\n    def initialize(type,\n                   absent: nil,\n                   block_eval: nil,\n                   fields: nil,\n                   joiner: nil,\n                   match: nil,\n                   optional: nil,\n                   post_parse: nil,\n                   pre_gen: nil,\n                   rollup: nil,\n                   rts: nil,\n                   separator: nil,\n                   to_line: nil,\n                   &block)\n      @type = type.intern\n      raise ArgumentError, _(\"Invalid record type %{record_type}\") % { record_type: @type } unless [:record, :text].include?(@type)\n\n      @absent = absent\n      @block_eval = block_eval\n      @joiner = joiner\n      @match = match\n      @rollup = rollup if rollup\n      @rts = rts\n      @separator = separator\n\n      self.fields = fields if fields\n      self.optional = optional if optional\n      self.post_parse = post_parse if post_parse\n      self.pre_gen = pre_gen if pre_gen\n      self.to_line = to_line if to_line\n\n      if self.type == :record\n        # Now set defaults.\n        self.absent ||= \"\"","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/util/fileparsing.rb#L48-L84","documentation":"A Puppet::Util::FileParsing FileRecord is created internally by record_line (type :record) and text_line (type :text); initialize interns the type and accepts only those two, raising ArgumentError otherwise. Hitting it means FileRecord.new was called directly with a non-standard type — the record_line/text_line DSL cannot produce this error.","triggerScenarios":"Calling Puppet::Util::FileParsing::FileRecord.new(:stream, fields: [...]) or a custom new_line_type wrapper passing an invented type such as :multiline or :csv, instead of going through the DSL.","commonSituations":"Custom providers copying Puppet internals and inventing new record kinds; monkey-patches that register record types without updating the parse dispatch.","solutions":["Use the record_line / text_line DSL, which always passes a valid type","If constructing FileRecord directly, pass exactly :record or :text","Model format quirks with :process / :to_line / :post_parse hooks on a legal record instead of a new type"],"exampleFix":"# before\nFileRecord.new(:multiline, fields: %i[content])\n# => ArgumentError: Invalid record type multiline\n\n# after\n# use the DSL, which only creates legal types\nrecord_line :chunk, fields: %i[content]","handlingStrategy":"validation","validationCode":"type = :record\nraise ArgumentError, 'bad type' unless %i[record text].include?(type)\nFileRecord.new(type, fields: %w[a b])","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer the record_line/text_line DSL over constructing FileRecord directly","Model line kinds as :record or :text plus hooks, never as new FileRecord types"],"tags":["puppet","provider","file-parsing","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}