Firefox refusing to load my manifest file

Hi, so I am a first time extension developer and currently making an extension for both chrome and firefox. Unfortunately, I have been running into the issue of firefox simply not accepting my manifest file. I’ve literally been trying for the better part of 30 minutes to get it working, with no success. Whenever I try to temporarily load the extension using the debugging tool, I get this error: File C:\Users\Max\Documents\extension-projects\YTAdBlockerBypass-firefox.zip does not contain a valid manifest

This is my manifest file:
{ "manifest_version": 3, "name": "Bypass YouTube Adblocker", "version": "1.0", "description": "This extension automatically removes YouTube's adblocker warning and resumes videos.", "permissions": [ "activeTab", "scripting" ], "icons": { "48": "icon-48.png", "96": "icon-96.png" }, "action": { "default_icon": { "48": "icon-48.png", "96": "icon-96.png" } }, "content_scripts": [ { "matches": ["<all_urls>"], "js": ["content.js"] } ], "applications": { "gecko": { "id": "ytadblockerbypass@hauber" } }, "scripting": { "host_permissions": [ "http://*/*", "https://*/*" ], "matches": [ { "include_globs": ["<all_urls>"], "js": ["content.js"] } ] } }

Anyone able to tell me what the issue here is? I would gladly appreciate a response

What I would also like to add is: This seems to be solely an issue with the manifest file, the icons exist, the content.js also exists.

The extension “id” in the “gecko” looks bad, try to append “.com”
More info: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json/browser_specific_settings#extension_id_format

Also, you can try to use “web-ext -lint”, it may print exact issue.

I have tried that, even tried to change it from applications to browser_specific_settings. It still does not work.

And also where do I run “web-ext -lint”?

Web-ext is a NodeJS console program for addon development, more info here:

In any case, there is one other way to find the exact issue - open browser console (Ctrl + Shift + J), clear the errors you see there and then click “Reload” button in the “about:debugging#/runtime/this-firefox” page to reload your addon.

That should print the exact issue with your manifest file.
For example:

1697286918904 addons.webextension.ytadblockerbypass@hauber ERROR Loading extension ‘ytadblockerbypass@hauber’: Reading manifest: The “default_locale” property is required when a “_locales/” directory is present.

I just did exactly that, but it still saying the same thing. Weirdly enough if I run it with web-ext run, the extensions seems to load, but I don’t know if it works

How to load packed extensions (.zip or .xpi) in Firefox:
(the instructions in both links are the same)

web-ext run loads unpacked extensions.

I wasn’t able to reproduce the issue you described, @Hauber. I took the manifest you provided, created some empty files for the images and content script, zipped them up, and loaded the zip as a temporary add-on in about:debugging#/runtime/this-firefox. I don’t see the error you described, but I do see warning messages. Here’s what I see:

That said, I should mention that you don’t need to zip extensions when you’re developing an extension. You can load the extension on your file system directly by selecting one of the extension files in the extension’s root directory as described here: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Your_first_WebExtension#installing

I can reproduce the problem if I zip the directory containing the extension files:
No_Valid_Manifest.zip (6.3 KB)

If I zip the files inside the directory, Firefox loads the extension:
Valid_Manifest.zip (5.7 KB)

So the issue is with the extension being zipped?

Ah! As you said, Firefox expects the extension files to be at the top level, not inside a directory. This is called out in one of the yellow info boxes on https://extensionworkshop.com/documentation/publish/package-your-extension/

The ZIP file must be a ZIP of the extension’s files themselves, not of the directory containing them.

1 Like