{"record":{"id":"49bd9d6dfb2ab3eb","repo":"SeleniumHQ/selenium","slug":"cannot-locate-extension-id-in-rdf-path","errorCode":null,"errorMessage":"cannot locate extension id in #{rdf_path}","messagePattern":"cannot locate extension id in #(.+?)","errorType":"exception","errorClass":"Error::WebDriverError","httpStatus":null,"severity":"error","filePath":"rb/lib/selenium/webdriver/firefox/extension.rb","lineNumber":82,"sourceCode":"          read_id_from_install_rdf(directory) || read_id_from_manifest_json(directory)\n        end\n\n        def read_id_from_install_rdf(directory)\n          rdf_path = File.join(directory, 'install.rdf')\n          return unless File.exist?(rdf_path)\n\n          doc = REXML::Document.new(File.read(rdf_path))\n          namespace = doc.root.namespaces.key(NAMESPACE)\n\n          if namespace\n            id_node = REXML::XPath.first(doc, \"//#{namespace}:id\")\n            return id_node.text if id_node\n\n            attr_node = REXML::XPath.first(doc, \"//@#{namespace}:id\")\n            return attr_node.value if attr_node\n          end\n\n          raise Error::WebDriverError, \"cannot locate extension id in #{rdf_path}\"\n        end\n\n        def read_id_from_manifest_json(directory)\n          manifest_path = File.join(directory, 'manifest.json')\n          return unless File.exist?(manifest_path)\n\n          manifest = JSON.parse(File.read(manifest_path))\n          applications_gecko_id(manifest) || name_and_version(manifest)\n        end\n\n        def applications_gecko_id(manifest)\n          manifest.dig('applications', 'gecko', 'id')&.strip\n        end\n\n        def name_and_version(manifest)\n          [manifest['name'].delete(' '), manifest['version']].join('@')\n        end\n      end # Extension","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/SeleniumHQ/selenium/blob/aa36b38e696a0909e973bdf5e2f9031ffe842c4b/rb/lib/selenium/webdriver/firefox/extension.rb#L64-L100","documentation":"Raised by Firefox::Extension#read_id_from_install_rdf (Error::WebDriverError) when an install.rdf exists but neither an <em:id> element/attribute in the Mozilla RDF namespace can be located. The extension id is required to name the installed extension directory. This indicates a malformed or legacy install.rdf missing the identifier.","triggerScenarios":"Installing a Firefox extension whose install.rdf lacks the em-rdf namespace id element/attribute; a hand-edited or truncated install.rdf; an old extension format Selenium cannot parse.","commonSituations":"Legacy extensions with non-standard manifests; extensions generated by tooling that omits the id; corrupted rdf after a partial extraction.","solutions":["Switch the extension to a WebExtension with a valid manifest.json (which read_id_from_manifest_json also supports).","Repair install.rdf to include a proper <em:id>...</em:id> under the http://www.mozilla.org/2004/em-rdf# namespace.","Re-download the addon from a trusted source in case of corruption."],"exampleFix":"// before: install.rdf missing em:id\n# <RDF><Description about=\"urn:mozilla:install-manifest\"> ... </Description></RDF>\n\n// after: add the em:id element with the namespace\n# <RDF xmlns:em=\"http://www.mozilla.org/2004/em-rdf#\">\n#   <Description about=\"urn:mozilla:install-manifest\">\n#     <em:id>my-extension@example.com</em:id>\n#     ...\n#   </Description>\n# </RDF>","handlingStrategy":"validation","validationCode":"rdf = File.join(dir, 'install.rdf')\nmanifest = File.join(dir, 'manifest.json')\nif File.exist?(manifest)\n  profile.add_extension(path)  # WebExtension path\nelsif File.exist?(rdf)\n  doc = REXML::Document.new(File.read(rdf))\n  ns = doc.root.namespaces.key('http://www.mozilla.org/2004/em-rdf#')\n  raise 'install.rdf has no em:id' unless ns && REXML::XPath.first(doc, \"//#{ns}:id\")\n  profile.add_extension(path)\nelse\n  raise 'extension has neither manifest.json nor a valid install.rdf'\nend","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer modern WebExtensions with a valid manifest.json.","Validate install.rdf contains an em:id before installing legacy addons.","Re-download addons from a trusted source if parsing fails (possible corruption)."],"tags":["firefox","extension","addon","manifest","rdf"],"backgroundTag":null,"analyzedSha":"aa36b38e696a0909e973bdf5e2f9031ffe842c4b","analyzedAt":"2026-08-14T02:32:32.244Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}