Fredo6 plugins - Error at startup (Error starting up plugin (creating menus and icons) undefined method `add_item´form nil:NilClass)

Some users have reported an error affecting my plugins at startup, preventing my plugins t load correctly. apparently, this is only on Windows platform.

When the Ruby console is opened, the error messages starts with

Error starting up plugin (creating menus and icons) undefined method add_item´for nil:NilClass`

I am unable to reproduce the problem or even to understand where it could come from.

So I have released LibFredo6 v12.6b, which includes a trace to document the context of the error.
If and only if the error happens,

  • The Ruby console will automatically opens
  • a trace will appear, starting with ***************ERROR LibFredo6 Menu **************, followed by the ruby error.

If this happens to you, thanks to post the trace in the present post.


1 Like

Well this tells you that #add_item method is being called upon an object that the code expects to be either a toolbar or menu object, but is unexpectedly nil.

One approach is to add in a conditional guard for all toolbar or menu objects that checks to be sure that they are not nil or respond_to?(:add_item) before adding commands or menu procs. When these are detected as nil then perhaps output an error to inform the user.

I understand where the error is, but not what causes it, knowing that only a handful of users have reported the error and also that the error may disappear on restart or reinstallation.

Catching the error would lead to not loading the plugin (i.e. not creating any menu entries or toolbar icon). So, it is not an option either.

Heya, Fredo! I just got this error trying to install the FredoSpline v2.3a plugin through the Extension Manager in SketchUp Pro 2022:

***************ERROR LibFredo6 Menu **************
Sketchup = 22.0.354
Platform = x64-mswin64_140
title = Quick Launcher
Ext = 
@submenu = 
@menu_name = FredoSpline
@su_menu_name = 

I restarted SketchUp and it appeared to install properly and brought up the toolbar, however, using the plugin in edit mode caused SketchUp to freeze. But I’m going to keep playing with it and see if that was user-error/bad inputs. Thanks for your great plugins!

Do you have LibFredo6 version 12.9a installed?


1 Like