{"record":{"id":"a505e1e49e240290","repo":"SeleniumHQ/selenium","slug":"add-on-path-does-not-exist-addon-path","errorCode":null,"errorMessage":"Add-on path does not exist: {addon_path}","messagePattern":"Add-on path does not exist: (.+?)","errorType":"exception","errorClass":"OSError","httpStatus":null,"severity":"error","filePath":"py/selenium/webdriver/firefox/firefox_profile.py","lineNumber":275,"sourceCode":"                    rc.append(node.data)\n            return \"\".join(rc).strip()\n\n        def parse_manifest_json(content):\n            \"\"\"Extract details from the contents of a WebExtensions manifest.json file.\"\"\"\n            manifest = json.loads(content)\n            try:\n                id = manifest[\"applications\"][\"gecko\"][\"id\"]\n            except KeyError:\n                id = manifest[\"name\"].replace(\" \", \"\") + \"@\" + manifest[\"version\"]\n            return {\n                \"id\": id,\n                \"version\": manifest[\"version\"],\n                \"name\": manifest[\"version\"],\n                \"unpack\": False,\n            }\n\n        if not os.path.exists(addon_path):\n            raise OSError(f\"Add-on path does not exist: {addon_path}\")\n\n        try:\n            if zipfile.is_zipfile(addon_path):\n                with zipfile.ZipFile(addon_path, \"r\") as compressed_file:\n                    if \"manifest.json\" in compressed_file.namelist():\n                        return parse_manifest_json(compressed_file.read(\"manifest.json\"))\n\n                    manifest = compressed_file.read(\"install.rdf\")\n            elif os.path.isdir(addon_path):\n                manifest_json_filename = os.path.join(addon_path, \"manifest.json\")\n                if os.path.exists(manifest_json_filename):\n                    with open(manifest_json_filename, encoding=\"utf-8\") as f:\n                        return parse_manifest_json(f.read())\n\n                with open(os.path.join(addon_path, \"install.rdf\"), encoding=\"utf-8\") as f:\n                    manifest = f.read()\n            else:\n                raise OSError(f\"Add-on path is neither an XPI nor a directory: {addon_path}\")","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/py/selenium/webdriver/firefox/firefox_profile.py#L257-L293","documentation":"Raised by FirefoxProfile's add-on manifest parser when the addon_path passed to it does not exist on the filesystem (os.path.exists returns False). The library validates the path before attempting any zip or directory read, so the user gets a clear error instead of a cryptic downstream failure.","triggerScenarios":"Calling the add-on install/parse API with a path to an .xpi file or directory that does not exist, a relative path resolved from the wrong working directory, or a typo in the path string.","commonSituations":"Relative paths that break when tests run from a different CWD. CI environments where addon files are not copied into the working tree. Paths with typos or wrong file extensions.","solutions":["Verify the path exists with os.path.exists(addon_path) before calling the API","Use an absolute path constructed with os.path.abspath or pathlib.Path.resolve()","Ensure the .xpi or addon directory is present in CI by checking it into the repo or downloading it as a build step"],"exampleFix":"// before\nprofile.add_extension('addons/myplugin')\n\n// after\nimport os\naddon = os.path.abspath('addons/myplugin')\nassert os.path.exists(addon), f'Addon not found at {addon}'\nprofile.add_extension(addon)","handlingStrategy":"validation","validationCode":"import os\naddon_path = 'addons/myplugin.xpi'\nif not os.path.exists(addon_path):\n    raise FileNotFoundError(f'Addon path does not exist: {addon_path}')\nprofile.add_extension(addon_path)","typeGuard":null,"tryCatchPattern":"try:\n    profile.add_extension(addon_path)\nexcept OSError as e:\n    print(f'Addon path invalid: {e}')\n    addon_path = resolve_addon_path()  # fallback logic","preventionTips":["Use absolute paths constructed with os.path.abspath","Verify file existence with os.path.exists before calling","Ensure addon files are present in CI by copying them as a build step"],"tags":["firefox","addon","filesystem","path-validation","profile"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}