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:
[code type=”javascript”]
// 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:
[code type=”javascript”]
// 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.


21 responses to “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…

    1. Mike Kaply Avatar
      Mike Kaply

      Unfortunately there were a lot of companies that were hijacking the Firefox search engines because it was so easy. That’s why this was done.

      I’ve built an add-on that does exactly what you’re looking for – you can simple add XML files directly to Firefox:

      Let me know if you need any additional help downloading XML files. I might add that support as well.

    2. Mike Kaply Avatar
      Mike Kaply

      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.

      1. Michael Avatar

        Great, that works. Thank you for this solution!
        Currently, another option is using Pale Moon 26.

  2. Pulkit Sharma Avatar
    Pulkit Sharma

    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

    1. Mike Kaply Avatar
      Mike Kaply

      You can, but it’s complicated. CCK2 supports this function out of the box…

  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!


    1. 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!

      1. Mike Kaply Avatar
        Mike Kaply

        It looks like Google broke the feature. The button is still there on their webpage, but when you click it, it returns regular results.

        1. Uh oh! Thanks for the info. I’ll cross my fingers that they fix it! Thanks for all you do!


  4. Michael Avatar

    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?

    1. Mike Kaply Avatar
      Mike Kaply

      I do not. Sorry.

  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?


    1. Mike Kaply Avatar
      Mike Kaply

      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.

    1. Mike Kaply Avatar
      Mike Kaply

      Resources Directory:

  7. hello
    On FF 60.3 ESR :
    autoconfig.js should be placed in : [Firefox directory]\defaults\prefs
    but your config file mentionned in autoconfig.js (mozilla.cfg for example) should be in
    [Firefox directory]\

  8. Hi
    I have Firefox 76
    my mozilla.cfg is saved in C:\program files\firefox\mozilla.cfg
    start with:
    // Mozilla User Preferences

    pref(“accessibility.browsewithcaret”, true);
    pref(“accessibility.typeaheadfind.flashBar”, 0);
    pref(“app.normandy.first_run”, false);

    my autoconfig.js is saved in C:\Program Files\Mozilla Firefox\defaults\pref\autoconfig.js
    start with:
    // — Configuration of Firefox
    pref(“general.config.filename”, “mozilla.cfg”);

    if I change my mozilla.cfg with:
    The lockPref(“a.b.c.d”, “e.f.g.h”);

    I don’t see entries in about:config
    My mozilla.cfg does not work, what is the problem ?

    1. Mike Kaply Avatar
      Mike Kaply

      You’re missing pref(“general.config.obscure_value”, 0);


  9. Great troubleshooting steps here. Actually had 2 issues with mine both permissions.
    Had to set local-settings.js (or autoconfig.js) to rwxr-xr-x and my mozilla.cfg to rw-r–r–. Once that was taken care of things started to work. I spent hours on everything else until this.

    System: Centos 7 – mozilla 68.9

  10. Hello,
    i have the reversed problem
    i am locked out from my local drive at all and severall buttons wont work …
    eg on mozzila the ‘choose subject’ selector on their ask-form so i can nott submit

Leave a Reply

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