I'm getting a random bug when my Settings menu (Gear icon in the top right corner) does not appear sometimes on my SP Online site. I found that when it happens I have an error in my console (see below).

When I refresh the page it is all good, if I refresh 10 times, I'm getting this problem 2-3 times. Looks like some race condition is involved. I've traced the error and it looks like a bug in SP JavaScript code. It all looks like:

enter image description here

Here are all details about the error:

The console error: This error I see in console

Here is the piece of code where the bug sits: enter image description here

So line return e.Id === n.newWorkloadSettingLink.Id fails because e sometimes null. I traced the source of e and it looks like it an iteration from _spPageContextInfo.MenuData.SettingsData array + merged with something else (+5 more elements) where one element is null in my case (item with index 3).

enter image description here

If I'm fast enough (can include script which runs on a page before the error call) and run the following block of code on Init in my Application Customizer extension, error disappears:

    const links = _spPageContextInfo.MenuData.SettingsData;
    for (let i=0; i < links.length; i++) {
      if (!links[i]) {
        links.splice(i, 1); // Removing item if it has no value

But this is kind of hack, and obviously, I need some help to understand how to resolve this issue for good. Does anyone have any idea why do I have one element in the array set to null or why Microsoft has this bug?

PS.: I play with SP on my own non-commertial research project and don't have any MS support subscription. Anyway I don't believe they will fix this bug for me in shot time as they are a bit slow sometimes. My last hope that someone from the community already saw/solved something like this :) Thanks everyone in advance!


You should open a support ticket via the Microsoft 365 Admin center. All plans have support via this mechanism. As you noted, there is nothing we can do to help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.