The ribbon on one specific site in a site collection will not load, it stays on loading, and two lists I have that use grouping will not expand, they also stay on loading. This is only happening on one specific site i.e. http://server/collection/abc/def/xyz, it doesn't happen on any other site in the collection http://server/collection/abc/def or http://server/collection/abc/def/ghi. This happens across multiple browsers and multiple users/machines. Site Actions still works. If you start at the home page of the site, the ribbon does load on the Page tab, but if you navigate anywhere else (to a list, library, calendar, etc) the ribbon does not work.

This is not due to any load balancers (we have none), loop back issues or DNS devolution (it only happens to one site). This error has appeared in the last ~12 days I would say; before that the ribbon and grouping worked fine. Single-server farm. No updates happened, server did not go down. IIS Reset is ineffective.

There is custom JS added to the master page for this site but it should be unrelated. It's used to add two custom Quick Launch links to upload stuff to the document library. This is the code (URLs and GUIDs replaced):

<SCRIPT language=javascript type=text/javascript>       
    function newDocLinkFn(){

    function uploadDocFn(){
        '/collection/abc/def/xyz/_layouts/Upload.aspx?List={<<GUID>>}&RootFolder=/collection/abc/def/xyz/Documents&Source=<<document library URL>>');

Browser console shows this error upon debug:

SCRIPT5007: Unable to get property 'getElementsByTagName' of undefined or null reference

File: sp.js, Line: 2, Column: 282286

Here's some screenshots:

Ribbon not loading:


Grouped list not expanding:

grouped list

Edit: I removed the custom JS code to see if that was the culprit but there was no change. Master page has been reset to site definition, the ribbon still does not load

Ran SP.js in DEBUG mode and got these results:

The error is thrown on line 11852, on the this.$D_2.getElementsByTagName('ul') call.

$3x_2: function() {ULS5Vl:;
    var $v_0 = this.$D_2.getElementsByTagName('ul');
    for (var $v_1 = 0, $v_2 = $v_0.length; $v_1 < $v_2; ++$v_1) {
        if (Sys.UI.DomElement.containsCssClass($v_0[$v_1], 'dynamic')) {
            var $v_3 = $v_0[$v_1].parentNode;
            $v_3.hoverDebouncer = 0;

Call stack:

  • SP.UI.AspMenu.prototype.$3x_2 [Line: 11852, Col: 9], sp.debug.js
  • SP.UI.AspMenu.prototype.initialize [Line: 11847, Col: 9], sp.debug.js
  • Sys$Component$endUpdate [Line: 2587, Col: 33], ScriptResource.axd
  • Sys$Component$create [Line: 2743, Col: 9], ScriptResource.axd
  • init_zz18_TopNavigationMenuV4 [Line: 708, Col: 43], viewlsts.aspx
  • NotifyEventAndExecuteWaitingJobs [Line: 5189, Col: 5], init.debug.js
  • NotifyScriptLoadedAndExecuteWaitingJobs [Line: 5206, Col: 2], init.debug.js
  • Global code [Line: 14900, Col: 1], sp.debug.js

This happens as soon as the page is refreshed on the View All Site Content page, not even trying to click anything yet and not even in a document library. Again it seems strange me because the Site Actions menu still works fine.

It appears the .getElementsByTagName('ul') isn't returning anything, in the function directly above the one in the snippet above:

initialize: function() {ULS5Vl:;
    SP.UI.AspMenu.callBaseMethod(this, 'initialize');
    this.$D_2 = this.get_element().getElementsByTagName('ul')[0];

this is pointing to the SP.UI.AspMenu object and the get_element() returns an object but that object, at least from the IE debugger, does not appear to have any method called getElementsByTagName().

One other weird thing I just noticed is that on the home page of the site I have an OOTB Announcements web part and when I'm debugging with the console open and I click the "Add new announcement" button, it throws an error from NewForm.aspx saying permission denied when it tries to do this:

document.write('<script type="text/javascript" src="/_layouts/1033/init.debug.js?rev=OclaJxOddeqyem2grw%2Br8Q%3D%3D"></' + 'script>');

Not sure if it's related or just another issue.

  • With your custom code, try to either use SP.SOD.executeFunc("sp.js","SP.ClientContext",yourCodeHandle); or _spBodyOnLoadFunctionNames.push("yourCodeHandle"); instead of things like $(document).ready(yourCodeHandle); as they wait for the required SharePoint scripts to load and will prevent some interference. Also if you're loading any external JavaScript libraries on this site you may causing issues there too. For instance, loading jQuery twice on a page doesn't work very well...
    – KGlasier
    Feb 2, 2019 at 17:16
  • @KGlasier I tried taking out the custom JS and reset the master page to site definition to see if it made any difference but it didn't, the ribbon still does not load Feb 15, 2019 at 18:06

1 Answer 1


Unfortunately, that's a very generic error message. To dig into it, you'll need to get SharePoint to load the *.debug.js versions of it's scripts. The easiest way to do that is to modify the master page:

  • Find the ScriptManager tag.
  • Add the attribute ScriptMode="Debug", or if ScriptMode is already present change it to "Debug" (you said master page is reset, so ScriptMode probably needs to be added)

Once you do that, reload your page, and find out what line it says the error occurred on in sp.js (I know the console says line 2 right now, but that's because it's minimized, everything is on line 2). Then go to that line, put in a break point, and see what it's trying to do when it crashes (which may or may not be the first time it hits that line). i.e. what tag is it trying get? And who's calling it (look at the stack trace)?

With more information, someone may be able to help.


Honestly, at this point you've been dealing with this issue for a month. Were I in your shoes, I would create another site, move the data over to it (hopefully with a tool like ShareGate if available, to preserve as much of the history as possible, if you care about that), and delete the old site if the new site acts as expected. Not a very satisfying solution I'll admit, but it'd probably take less than a month regardless of how much data is involved.

When you mentioned the access denied on document.write I started to suspect some kind of permissions issue, but the lack of any "401 Unauthorized" or "403 Forbidden" errors on the network tab makes that less likely. I've seen permissions messed up enough that even as an SCA, I'd get "403 Forbidden" errors on resources in the layouts directory, and that's bad, but clearly not your issue.

And presumably, this.get_element() is returning an Element, but getElementByTagName is part of the prototype for Element. So is this.get_element() returning something other than an Element, or has something mucked with the prototype for Element? Neither make a lot of sense, and the latter makes no sense if no custom JavaScript is being loaded at all. Of course, I started this paragraph with a presumption, and that's always dangerous in the SharePoint world. Maybe this.get_element() doesn't always return an Element? But in the particular case, the caller clearly expects that it does.

Wish I could have been more help. I can't honestly say this is the most bizarre thing I've seen in SharePoint, but it's tied. And when it starts to look like rebuilding would be faster than diagnosing, I'm going rebuild every time.

  • I added some more details to the original question at the bottom. Honestly I'm not sure of what to make of it, I've never seen anything like this, especially since it's only happening on this one site and none of the others in the site collection. Feb 15, 2019 at 22:25
  • The fact that it's only happening on one site collection is a clue itself. That tends to lead to something like JavaScript in mater page or just broken master page (you've already eliminated that), JavaScript through user custom actions, custom full trust features (I'm guessing you would have mentioned that). What version of SharePoint? Next thing I would look for is I would look at every JavaScript reference in the live DOM or the Network tab of developer tools, for anything that looks suspicious, particularly for anything that resides in the site collection (style lib, mater gallery, etc.)
    – Joe McShea
    Feb 16, 2019 at 0:06
  • Also, this.$D_2 is obviously an HTML element. What is it? Take a look at this.$D_2.outerHTML in the watch window.
    – Joe McShea
    Feb 16, 2019 at 0:13
  • Also, look at the Network tab on page load to see if you're getting any errors loading resources, especially access denied.
    – Joe McShea
    Feb 16, 2019 at 0:22
  • So at this point there's no custom JS anywhere, master page was reset to site definition, no custom features whatsoever. Even other sites within the same site collection function fine, it's just this one particular site within the site collection. This is SharePoint Server 2010. this.#D_2 is being set to this.get_element().getElementsByTagName('ul')[0]; but it doesn't return anything. The call to this.get_element() returns an object but that object does not have a .getElementsByTagName() function which is the whole root of this issue. No errors on the network tab, everything is loading. Feb 23, 2019 at 0:10

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.