So, the code in the documentation assumes that the menu you’re trying to get is set as the primary
menu. If the menu you’re trying to get isn’t the one set as primary
in Apperance -> Menus, this error will show. I suggest you try to work with their name
or slug
instead.