Debugging Firefox AutoConfig Problems

I get a lot of questions about debugging AutoConfig issues, so I thought I would document what I do to try to track them down.

If Firefox starts, go to about:config and search for general.config. Make sure there are values for general.config.filename and general.config.obscure_value. If they are not there, your defaults/prefs/autoconfig.js file is not being read. The most common reason this happens is permissions or you’ve placed it in the wrong directory.

If both the general.config values are present, the next step is to check if your cfg file is being read. I usually make a very simple cfg file:

// First line is always a comment
lockPref("a.b.c.d", "e.f.g.h");

Then I go to about:config and verify that the a.b.c.d preference is there (it will be at the top). If the preference is not there, then something must be very wrong. I check the browser console to see if there are any errors. If the preference is there, AutoConfig is working correctly. I then start adding it the parts of my AutoConfig file a piece at a time, leaving the setting of the a.b.c.d pref at the end of the file. Then I check about:config each time and see which line is breaking the AutoConfig file.

If the browser doesn’t start at all, the first thing I do is put all my AutoConfig code in a try/catch block like this:

// First line is always a comment
try {
  // My AutoConfig code.
} catch (e) {

If the browser then starts, I look in the browser console to see what the error was. If the browser still doesn’t start, I start removing pieces of my AutoConfig until it does.

The most common problem in the past with AutoConfig was the use of let instead of var. This was fixed in Firefox 42 and should no longer be an issue. Some other common problems were around the use of international characters, in particular saving AutoConfig files as UTF-8 versus ASCII. This should also be fixed. All AutoConfig files should be saved as UTF-8.

In general, as long as you don’t have JavaScript syntax errors in your AutoConfig file, they should just work. That’s been my experience, and I’ve written some pretty complicated AutoConfig files.

Please note: I reserve the right to delete comments that are offensive or off-topic.

Leave a Reply

Your email address will not be published. Required fields are marked *

16 thoughts on “Debugging Firefox AutoConfig Problems

  1. Thanks Mike for the AutoConfig update.

    An urgent topic came to my attention lately when I customised a new profile from scratch: the search engine problem. I found out that Mozilla stores all its configuration in the LZ4 compressed file search.json.mozlz4 now. Annoyingly, it’s not feasible any longer to get new search engines (Mycroft etc.) as separate files to customise them afterwards (e.g. removal of tracking ids), they’ll get directly written into search.json.mozlz4.

    There’s little what one can do, Florian Quèze mentioned one awkward method:

    This is another bad decision from Mozilla to piss off its loyal long-term users.
    How may I manage (customised) search engines, how do I scrape newly installed (Mycroft) additional engines out of search.json.mozlz4? I don’t need to automatise this, I’m just searching for a viable way…

    • I’ve just updated the add-on to support downloading XML files. So you can hold down the shift key when clicking on mycroft and get a copy of the XML file. You can then modify the XML and add it via the Add button in preferences.

  2. Hi Mike.
    Thanks to you I was able to add certificates using AutoConfig.
    I am using Firefox 49. The problem now I am facing is that some websites provide an invalid certificate see ( ) , they are not being verified by Firefox (even after adding their certificate).
    I can still trust the server by manually adding it (clicking on ‘Add Exception’ in the Servers tab of ‘View Certificates’).
    Anyway to do that via AutoConfig ?
    Thanks Again

  3. Hey Mike,

    I can’t get Keyword Search to work anymore and I use it heavily. It was working fine then I noticed it stopped recently. I think it stopped despite everything remaining the same on my end. I tried re-installing Keyword Search but that didn’t do it. I tried an older version of Firefox without any luck, and I trashed my Firefox preferences folder in Application Support but that didn’t fix it either. Any idea of what happened?

    I didn’t know how to contact you about this so I had to reply to this blog post. Sorry about that.

    Let me know, thanks!


    • BTW I forgot to mention that the feature I use is “I’m feeling lucky” where I type in the name of a website and it goes there automatically. It worked great before and I thank you for making it. Let me know if we can get it working again somehow. Thanks!

  4. Mike, do you happen to know whether Mozilla removed an API for (fav)icon treatment recently?
    I noticed that other than in former versions (Firefox 46), favicons of bookmarks can no longer be modified using “Bookmark Favicon Changer” (and customised ones revert back to their original state once activated). I might workaround the problem with a tedious userchrome.css hack.
    Do you know a more straightforward solution like an add-on?

  5. I’ve been playing with CCK2 for a couple of weeks now and it seems like everything is working nicely – my NTLM is passing through, the import of my certificate looks good (I’m not getting google errors – so that’s good!). But this is only on a new profile.

    Staff who already have an existing profile don’t seem to be getting the certificate settings – is there a way to do that – update an existing firefox profile?


    • Existing profile shouldn’t be an issue. Have these folks ever had the CCK2 installed at all? I only install certificates at first run of the CCK2 (or an upgrade).

  6. What would be the correct location of the autoconfig.js file? I built the config with CCK2 and by default it placed it in :

    Please advise, thank you in advance.