{"record":{"id":"cb2a5df6c214c67b","repo":"puppetlabs/puppet","slug":"unable-to-write-the-file-file-path-error","errorCode":null,"errorMessage":"Unable to write the file %{file_path}. %{error}","messagePattern":"Unable to write the file %(.+?)\\. %(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/puppet/util/plist.rb","lineNumber":152,"sourceCode":"      when :xml\n        CFPropertyList::List::FORMAT_XML\n      when :binary\n        CFPropertyList::List::FORMAT_BINARY\n      when :plain\n        CFPropertyList::List::FORMAT_PLAIN\n      else\n        raise FormatError, \"Unknown plist format #{format}\"\n      end\n    end\n\n    # This method will write a plist file using a specified format (or XML\n    # by default)\n    def write_plist_file(plist, file_path, format = :xml)\n      plist_to_save       = CFPropertyList::List.new\n      plist_to_save.value = CFPropertyList.guess(plist)\n      plist_to_save.save(file_path, to_format(format), :formatted => true)\n    rescue IOError => e\n      Puppet.err(_(\"Unable to write the file %{file_path}. %{error}\") % { file_path: file_path, error: e.inspect })\n    end\n\n    def dump_plist(plist_data, format = :xml)\n      plist_to_save       = CFPropertyList::List.new\n      plist_to_save.value = CFPropertyList.guess(plist_data)\n      plist_to_save.to_str(to_format(format), :formatted => true)\n    end\n  end\nend\n","sourceCodeStart":134,"sourceCodeEnd":162,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/util/plist.rb#L134-L162","documentation":"Raised by Puppet::Util::Plist#write_plist_file when the CFPropertyList save call fails, so the serialized plist could not be written to file_path. The rescue in write_plist_file turns the underlying exception into this error with the path and reason included — typically a permissions, path, or disk problem.","triggerScenarios":"Thrown at lib/puppet/util/plist.rb:152 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that file_path's directory exists and the Puppet user has write permission","Verify there is adequate disk space and the path is not a directory","Inspect the embedded error message for the specific I/O failure"],"exampleFix":null,"handlingStrategy":"try-catch","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"}