{"record":{"id":"027df62de61178fa","repo":"SeleniumHQ/selenium","slug":"model","errorCode":null,"errorMessage":"#{model}","messagePattern":"#\\{model\\}","errorType":"exception","errorClass":"Errno::ENOENT","httpStatus":null,"severity":"error","filePath":"rb/lib/selenium/webdriver/common/profile_helper.rb","lineNumber":66,"sourceCode":"      end\n\n      private\n\n      def create_tmp_copy(directory)\n        tmp_directory = Dir.mktmpdir('webdriver-rb-profilecopy')\n\n        # TODO: must be a better way..\n        FileUtils.rm_rf tmp_directory\n        FileUtils.mkdir_p File.dirname(tmp_directory), mode: 0o700\n        FileUtils.cp_r directory, tmp_directory\n\n        tmp_directory\n      end\n\n      def verify_model(model)\n        return unless model\n\n        raise Errno::ENOENT, model unless File.exist?(model)\n        raise Errno::ENOTDIR, model unless File.directory?(model)\n\n        model\n      end\n\n      module ClassMethods\n        def from_json(json)\n          data = decoded(json)\n\n          Tempfile.create do |zip_path|\n            File.open(zip_path, 'wb') { |zip_file| zip_file << Base64.decode64(data) }\n\n            new Zipper.unzip(zip_path)\n          end\n        end\n      end # ClassMethods\n    end # ProfileHelper\n  end # WebDriver","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/rb/lib/selenium/webdriver/common/profile_helper.rb#L48-L84","documentation":"ProfileHelper#verify_model validates a profile directory path used by browser profiles (Chrome/Firefox). It raises Errno::ENOENT when the path does not exist, and Errno::ENOTDIR when the path exists but is not a directory. The error message is the path string itself. A nil model short-circuits and returns without error.","triggerScenarios":"Passing a non-existent profile directory path to a Firefox/Chrome Profile. Pointing the profile at a file rather than a directory. The profile directory was deleted or moved after configuration.","commonSituations":"Hard-coding a profile path that differs across machines. Copying a profile config without copying the directory. Path resolved relative to the wrong working directory.","solutions":["Ensure the profile path exists and is a directory: File.directory?(path).","Use an absolute path to the profile directory.","Pass nil if you want to skip the model check and use a default/temporary profile."],"exampleFix":"# before\nprofile = Selenium::WebDriver::Chrome::Profile.new('/missing/path')\n\n# after\nprofile = Selenium::WebDriver::Chrome::Profile.new('/absolute/path/to/profile')\n# or nil to skip\nprofile = Selenium::WebDriver::Chrome::Profile.new(nil)","handlingStrategy":"validation","validationCode":"raise Errno::ENOENT, path unless model.nil? || File.exist?(model)\nraise Errno::ENOTDIR, path unless model.nil? || File.directory?(model)","typeGuard":"def valid_profile_dir?(path)\n  path.nil? || (File.exist?(path) && File.directory?(path))\nend","tryCatchPattern":"begin\n  profile = Selenium::WebDriver::Firefox::Profile.new(model)\nrescue Errno::ENOENT, Errno::ENOTDIR\n  profile = Selenium::WebDriver::Firefox::Profile.new(nil)\nend","preventionTips":["Use absolute paths for profile directories.","Check File.directory?(path) before constructing a Profile.","Pass nil to use a default/temporary profile when the path is uncertain."],"tags":["ruby","profile","filesystem","browser-config"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}