Sometimes you’re running into a very time consuming bug, which has a very simple, but hard to find solution. During the tests of an updated product, the SharePoint ribbon was throwing the totally clueless JavaScript error “Invalid argument” in the “cui.js”. Even more annoying was that only Internet Explorer was having problems, Chrome and Firefox performed ok.

invalid_argument_cui.js

After a long time of debugging, randomly an internal script error was complaining about an undefined width property. This clue pointed me in the right direction. Our ribbon element file was adding a dropdown to the ribbon. It turned out that the property “width” was not defined in its definition. Without this information, Internet Explorer will cause your customization to throw errors. Keep this is mind as a possible cause for cui.js errors.

CommandUIDefinition.Dropdown.Width.Required