{"record":{"id":"d4b0dc86f1ec43c9","repo":"puppetlabs/puppet","slug":"cannot-read-nonexistent-file-file","errorCode":null,"errorMessage":"Cannot read nonexistent file %{file}","messagePattern":"Cannot read nonexistent file %(.+?)","errorType":"validation","errorClass":"IniParseError","httpStatus":null,"severity":"error","filePath":"lib/puppet/util/inifile.rb","lineNumber":140,"sourceCode":"    attr_accessor :destroy_empty\n\n    # @!attribute [rw] file_collection\n    #   @return [Puppet::Util::IniConfig::FileCollection]\n    attr_accessor :file_collection\n\n    def initialize(file, options = {})\n      @file = file\n      @contents = []\n      @filetype = Puppet::Util::FileType.filetype(:flat).new(file)\n\n      @destroy_empty = options.fetch(:destroy_empty, false)\n    end\n\n    # Read and parse the on-disk file associated with this object\n    def read\n      text = @filetype.read\n      if text.nil?\n        raise IniParseError, _(\"Cannot read nonexistent file %{file}\") % { file: @file.inspect }\n      end\n\n      parse(text)\n    end\n\n    INI_COMMENT = Regexp.union(\n      /^\\s*$/,\n      /^[#;]/,\n      /^\\s*rem\\s/i\n    )\n    INI_CONTINUATION = /^[ \\t\\r\\n\\f]/\n    INI_SECTION_NAME = /^\\[([^\\]]+)\\]/\n    INI_PROPERTY     = /^\\s*([^\\s=]+)\\s*=\\s*(.*)$/\n\n    # @api private\n    def parse(text)\n      section = nil   # The name of the current section\n      optname = nil   # The name of the last option in section","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/util/inifile.rb#L122-L158","documentation":"Raised as IniParseError by Puppet::Util::IniConfig::PhysicalFile#read (lib/puppet/util/inifile.rb:140) when the underlying flat filetype read returns nil, meaning the configured INI file does not exist (or is unreadable such that its content is nil). The reader cannot parse a nonexistent file, so it aborts with the inspected path in %{file}.","triggerScenarios":"Thrown at lib/puppet/util/inifile.rb:140 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create the INI file %{file} before code that reads it, or make reading conditional on File.exist?.","Correct the configured file path if it points to the wrong location.","Check permissions if the file exists but cannot be read."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","contentChangedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}