{"record":{"id":"21687da2cd1ca34a","repo":"SeleniumHQ/selenium","slug":"could-not-find-extension-at-path-inspect-21687d","errorCode":null,"errorMessage":"could not find extension at #{path.inspect}","messagePattern":"could not find extension at #(.+?)","errorType":"exception","errorClass":"Error::WebDriverError","httpStatus":null,"severity":"error","filePath":"rb/lib/selenium/webdriver/firefox/extension.rb","lineNumber":31,"sourceCode":"# Unless required by applicable law or agreed to in writing,\n# software distributed under the License is distributed on an\n# \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, either express or implied.  See the License for the\n# specific language governing permissions and limitations\n# under the License.\n\nmodule Selenium\n  module WebDriver\n    module Firefox\n      #\n      # @api private\n      #\n\n      class Extension\n        NAMESPACE = 'http://www.mozilla.org/2004/em-rdf#'\n\n        def initialize(path)\n          raise Error::WebDriverError, \"could not find extension at #{path.inspect}\" unless File.exist?(path)\n\n          @path             = path\n          @should_reap_root = false\n        end\n\n        def write_to(extensions_dir)\n          root_dir = create_root\n          ext_path = File.join extensions_dir, read_id(root_dir)\n\n          FileUtils.rm_rf ext_path\n          FileUtils.mkdir_p File.dirname(ext_path), mode: 0o700\n          FileUtils.cp_r root_dir, ext_path\n\n          FileReaper.reap(root_dir) if @should_reap_root\n        end\n\n        private\n","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/rb/lib/selenium/webdriver/firefox/extension.rb#L13-L49","documentation":"Raised by Firefox::Extension.new (Error::WebDriverError) when the given path does not exist on disk (File.exist?(path) is false). The constructor expects a real directory or an archive file (.xpi/.zip) for the Firefox extension to install.","triggerScenarios":"Calling Profile#add_extension(path) or installing an addon with a path that points to a nonexistent file/directory; a typo in the path; a relative path resolved against the wrong working directory.","commonSituations":"Bundled extension path computed at runtime that doesn't match the deployed layout; CI running from a different working directory than local; path built via string interpolation that yields nil (e.g. \"#{nil}/ext.xpi\").","solutions":["Verify the path with File.exist?(path) before constructing the Extension / calling add_extension.","Use an absolute path (File.expand_path) so resolution does not depend on the current working directory.","Confirm the extension file is actually packaged/copied into the expected location in CI."],"exampleFix":"// before\nprofile.add_extension('extensions/myext.xpi')  # file missing in CI\n\n// after\next_path = File.expand_path('extensions/myext.xpi', __dir__)\nraise \"extension not found: #{ext_path}\" unless File.exist?(ext_path)\nprofile.add_extension(ext_path)","handlingStrategy":"validation","validationCode":"ext_path = File.expand_path(path)\nraise \"extension missing: #{ext_path}\" unless File.exist?(ext_path)\nprofile.add_extension(ext_path)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Resolve paths with File.expand_path to avoid working-directory issues.","Check File.exist?(path) before constructing an Extension or calling add_extension.","Ensure extension artifacts are copied into place in CI before the test run."],"tags":["firefox","extension","filesystem","addon"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}