Add-on "appears to be corrupt" when trying to install my add-on's .xpi file in Firefox
Asked Answered
B

8

37

I am trying to install an extension in Firefox 45 (same happens with Firefox 49), but Firefox does not allow me to do that, indicating that

This add-on could not be installed because it appears to be corrupt. 

The way I am trying to install it is simply by dragging the .xpi file our team developed, into the Firefox window. This extension is based on MozRepl, but with some improvements.

Previously, I tried to install it but I couldn't as it was not signed (extensions in Firefox versions from 43 onwards require signing). I followed every step in order to sign it, according to this post: Signing a XPI. I am almost certain I could sign it correctly, but now the error Firefox displays is different: "This add-on could not be installed because it appears to be corrupt."

enter image description here

It seems that I am not creating the .xpi file correctly, but I am not sure which is the correct structure it should have. I tried different folder structures, but with no success.

Also, I checked the Browser Console to see what error is logged in, but I didn't found it really helpful. Here it is:

enter image description here

Here is a link to the .xpi file in case you want to check its content. Note that I tried moving the files manifest.mf, zigbert.rsa and zigbert.sf outside the META-INF folder, but it didn't work either.

Has anyone stumbled across an error like this when trying to install an add-on? Any ideas of what maybe happening?

Bourse answered 4/10, 2016 at 13:51 Comment(7)
if you rename the file with a .zip extension, can you open it as a zip file and read the contents of the file inside? if not, then it is indeed corruptTion
Please provide the directory structure you have in your .xpi file. Alternately, make your .xpi file available for us to look at it.Septet
@JaromandaX, yes I can unzip the file and see its content.Bourse
@Makyen: I edited the post to include a url to the .xpi fileBourse
@nicolasd92, I downloaded your .xpi file. Based on a superficial look, the basic file/directory structure appears to be correct (chrome.manifest and install.rdf in the root directory, META-INF (the signatures) present (I did not test them, but they superficially appear correct), etc.). However, due to the complexity of your add-on (e.g. it contains .dll and .exe files), I am unwilling to actually attempt to install it for security reasons (I would have to burn a VM, which I don't feel like doing at the moment).Septet
@nicolasd92, I should have been a bit more thorough. You appear to be using LZMA compression. Use "Deflate" as your compression method.Septet
@nicolasd92, In addition, as mentioned in my answer, you have signed this extension yourself. It needs to be signed by Mozilla, not you. See Signing and distributing your add-on. While this is not causing your current error, it will be an error as soon as you have a correctly compressed .xpi file.Septet
S
22

The .xpi file must use only "deflate" compression or uncompressed

The zip implementation within Firefox only supports uncompressed files or files compressed with the "Deflate" algorithm. You will need to create the .zip archive using the compression method "Deflate" instead of the "LZMA" which you are currently using. How to do so will depend on the tools you use to create your archive.

Personally, I use a batch file/shell script to create the .xpi file as I describe in detail in my answer to "Firefox extension .xpi file structure: description, contents, creation, and installation". The basics are that I use the zip command line tool which defaults to "deflate" or uncompressed. I use the -1 option to provide the fastest compression. Firefox/Mozilla use .xpi files both to package the files, but to also increase file access speed. The important quality is not a high compression ratio, but that the files can be accessed quickly. Unless Firefox is not an WebExtension and explicitly told to unpack the add-on by the install.rdf option <em:unpack>true</em:unpack> (WebExtensions don't have install.rdf files), the add-on will be installed as the .xpi file and all access to the add-on will be as the .xpi file.

Note: Given that your extension contains .dll files, you may need to have your add-on installed unpacked by using <em:unpack>true</em:unpack>.

Wrong signing method used. It must be signed by Mozilla, not yourself.

While it is not the error you are currently seeing, as soon as you fix the problem with your .xpi format, you will encounter an issue with your extension being signed by the wrong signature. You signed your extension with your own signature. It was not signed by Mozilla. This will not work. It must be signed by Mozilla, not yourself.You mentioned that you followed the directions in the MDN page Signing an XPI. However, as is clearly stated at the top of that page, the directions on that page are outdated and no longer work. You should have followed the link in the note to the page Signing and distributing your add-on. The note at the top of the page states:

Note: These instructions are outdated. For an extension to work in Firefox it must be signed by Mozilla, not by yourself. See Signing and distributing your add-on. [Emphasis added]

There are also a variety of questions here on Stack Overflow which address the signing issue.

Septet answered 4/10, 2016 at 15:53 Comment(0)
O
12

Like stated in other answer it happens for unverified/unsigned extension.

But sometimes for testing you might want to use unverified/unsigned extension. As a hack/workaround to install unverified/unsigned extensions following worked for me on Firefox version 45:

  1. Launch Firefox and hit - about:config
  2. Search for 'xpinstall.signatures.required'
  3. Either double click on the row OR set the value to false and close

Now retry installing the extension and it should work.

Observatory answered 30/6, 2017 at 9:53 Comment(5)
This does not seem to work anymore, unfortunately, even though the setting still exists.Tientiena
Sorry, yes, it does work, but only on Firefox nightly.Tientiena
@Tientiena the original question is about FirefoxObservatory
I know, and Firefox nightly is a Firefox version, but not the release one. In other words, your answer does not work with the "normal" FF versions that everyone uses.Tientiena
@Tientiena Not sure about the current version but when i posted the answer I was using Firefox release version and it was working with thatObservatory
H
9

I think there is something not clearly documented, I'd like to share my experience.

  1. Developed my extension and zipped all the files
  2. Selected On your own for How to Distribute this Version step and uploaded .zip to AMO
  3. Then, on the next page, I see a signed .xpi file available for download. I downloaded it and tried to install via "about:addons -> Install Add-on from file"
    1. I get corrupt add-on error in this case
  4. After receiving e-mail from [email protected], I went to my add-on's page and clicked on .xpi file link there and it worked!

enter image description here

Huba answered 19/8, 2017 at 0:22 Comment(0)
B
8

I had this issue when I compressed the folder containing my addon rather then just the files within.

Don't Compress the Parent Folder of your Manifest

Screenshot

For example, on Windows CTRL+Click on your manifest and any other files or subfolders; right click and select Send to > Compressed Folder and you should be good to go.

Note: from the browser console screenshot we can tell this isn't the issue in this case, but even so this is a common problem to the This add-on could not be installed because it appears to be corrupt error.

Brief answered 21/1, 2019 at 12:47 Comment(3)
Doing this using 7zip with the store compression level did it for meRoger
Doing this on about:debugging#/runtime/this-firefox, not about:addons worked for me.Bologna
Doing this with Mac default compression worked for me when attempting to make a Mozilla Thunderbird extension.Lecythus
T
5

The message because it appears to be currupt can point to various problems. You can see a more detailed error message in the Browser Console at ctrl+shift+J.

As soon as you edit anything inside an xpi file and try to add it manually to the browser, an extension ID needs to be provided inside the manifest.json if it isn't already, with applications.gecko.id or browser_specific_settings.gecko.id. For example, altering any single character in https://addons.mozilla.org/en-US/firefox/addon/quick-js-switcher/ shows Invalid XPI: Error: Cannot find id for addon in Browser Console, so you add

"applications": {
    "gecko": {
      "id": "[email protected]",
      "strict_min_version": "1.2.3"
    }
  }

to the manifest.json as well and it works: But only with about:config's xpinstall.signatures.required set to false on Firefox versions that actually respect this setting, which excludes the normal release one because apparently Mozilla hates its userbase. You need FF Nightly or the like, I'm using LibreWolf.

source

Tientiena answered 16/4, 2022 at 8:37 Comment(0)
C
0

This is an answer to a tangential question when the "The add-on downloaded from this site could not be installed because it appears to be corrupt" error message starts appearing when trying to install any Thunderbird add-on. There are some other sites where this tangential question has been asked but the pages got archived:

Since this question here still allows replies, just wanted to add that this can occasionally start happening for all add-ons if the user's local Thunderbird profile files gets corrupt in some specific way.

In such case, I recommend restarting Thunderbird in "safe mode" with all add-ons disabled via "Help" -> "Restart with Add-ons Disabled...", and then restarting back to the "regular" mode via "Help" -> "Restart with Add-ons Enabled". After that installation of add-ons may work again.

Even though this is not the answer to this specific question, hope this tip is helpful for whoever hits this specific tangential but similar situation.

Condemn answered 15/8, 2021 at 3:27 Comment(0)
M
0

I had the same problem on firefox 52, just downgrade the addon to a lower version designed for firefox 52 or less will fix this problem.

Mailer answered 2/6, 2022 at 11:57 Comment(0)
B
0

Temp Load Extension via Debug Add-Ons

You can use the Add-Ons page, and click the Gear icon, and choose the Debug Add-Ons menu option.

Then, you can load your extension's .zip file without needing to sign it.

It's temporary, probably only for the current session, but it's good for debugging.

enter image description here

Brief answered 13/1 at 2:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.