Web extensions noob - getting: There was an error during installation: Extension is invalid

I have an extension on addons.mozilla.org using the old way of making extensions, and I am trying to learn web extensions. I went through the “your first” and “your second” tutorials on here (https://developer.mozilla.org/en-US/Add-ons/WebExtensions), and tried the borderify one and it works. I am trying to make a simple extension that just creates an alert, and I get this error:

There was an error during installation: Extension is invalid

That’s all I get. I have no idea where to start looking for the bug. I validated the manifest.json on jsonlint.com and it validated. The files are here:

Please help me understand what it doesn’t like. Thanks!

Since it isn’t signed/reviewed, you need to load it in FF using Temporary addon page.
about:debugging
Addon will be only be installed for the browser session.
You’ll need to reload it again if you close FF and reopen it.

If that is not your issue, you may need to include the following in your manifest.

   "applications": {
      "gecko": {
         "id": "YOUR EXTENSION ID HERE"
      }
   },

Create an ID if you don’t have one.
Something like "mycoolextension@mycoolextension.com" should work.

1 Like

Looks like it was in the content_scripts.matches. I changed it from

["*:*"]

to

["*://*/"]

and it loaded.

1 Like

Well… there ya go! Have fun!

2 Likes

I got the same error for an unrelated problem (a localization json file malformed), it would be good to know if there is a way to debug why this error appears, because if not you can waste a lot of time testing blindly.

Cheers.

1 Like

Doesn’t the browser console tell you the exact error?

1 Like

Hi @nukeador, we recommend using about:debugging or web-ext during development to check for errors.

1 Like

The problem was that I was unable to debug because about:debugging was the one giving me that general message when trying to load the extension.

To reproduce my problem it is just as easy as putting some white lines in a _locales/en/messages.json file, that will cause you not being even able to load the extension to debug.

Cheers.

Exactly, which is why I suggested to inspect the browser console. If I remember correctly, I had the same issue some weeks ago and the browser console tells you the exact error.

1 Like

Same problem here. I followed the sample from [1] with differences in the manifest data and the ID and it won’t install. The console gives me some of Firefox’ guts that I can’t handle. Nothing related to my files. What should I do?

Oh, in case it wasn’t mentioned, I used about:debugging to temporarily load the add-on as suggested in the MDN Wiki. That gives me the useless error message that sounds like “meh”.

[1] https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Your_first_WebExtension

Oh, it seems my extension ID was wrong. Isn’t a URI a valid ID? E-Mail addresses seem to work fine. There’s absolutely no documentation about the constraints of an ID. Maybe the documentation could be updated in that area. And the error message, too. The sample web-extensions don’t provide any clue either because none of them has an ID.

https://developer.mozilla.org/en-US/docs/Archive/Add-ons/Install_Manifests#id is still the source of truth for extension ID formats, even if it is an archived page. It may be time to move that documentation into the WebExtensions documentation, I guess.

P.S.: that is linked from the applications.gecko.id manifest key documentation.

It may be time to move that documentation into the WebExtensions documentation, I guess.

This is done, thanks for raising it: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/manifest.json/applications#Description

I just tried to port my Chrome extension over to Firefox 59 by following the guidelines, but no luck – I’m also getting this error when using “Load Temporary Add-on” in about:debugging. I’m getting this error in the console:

There’s https://www.extensiontest.com/, but it’s not working for me (see GitHub issue #14). Now I’m left scratching my head as to why my extension is invalid.

1 Like

I was also getting the vague “There was an error during installation: Extension is invalid” message and couldn’t pin it down.

I fixed it by changing manifest version to 2 after looking at this article: There was an error during installation: Extension is invalid.

None of the error messages mention this, but it seems pretty straightforward to catch and specify.

I too fixed by changing manifest version to 2. This is a weird work around
I tested my extension local in about:debugging page only. The above comment worked for this
Thanks anyway for this reply, Peter! This helped

[ACTION FAILED] TEMPORARY_EXTENSION_INSTALL_FAILURE: background.service_worker is currently disabled error-logging.js:16:17
errorLoggingMiddleware resource://devtools/client/aboutdebugging/src/middleware/error-logging.js:16
debugTargetListenerMiddleware resource://devtools/client/aboutdebugging/src/middleware/debug-target-listener.js:107
Redux 2
installTemporaryExtension resource://devtools/client/aboutdebugging/src/actions/debug-targets.js:139