"undefined method `new` error after changing nickname field

I am trying to change the nickname field to something else, per https://aresmush.com/tutorials/config/demographics.html#nickname_field-and-nickname_format, by:

  1. changing the nickname demographic to codename
  2. making sure it’s changed everywhere else it’s referenced in demographics.yml
  3. changing the ‘nickname field’ to ‘codename’
  4. changing the ‘nickname format’ field to ‘%{name} %{codename}’

I save and reload the plugins, but then all commands which involve the nickname fail to fire, and I receive the error:

%% Sorry! The code lost its mind while executing a command.  Not your fault.
Please send this error information to the admins and tell them what you were doing at the time:
Description: "look"
Error: "key{codename} not found"

%% Sorry! The code lost its mind while executing a command.  Not your fault.
Please send this error information to the admins and tell them what you were doing at the time:
Description: "look"
Error: "undefined method `new' for :get_web_request_handler:Symbol
Did you mean?  next"

Even after I put the settings in the demographics.yml back to the default of ‘nickname,’ and erased everyone’s demographics with ruby Character.all.each { |c| c.update(demographics: {})}, this error keeps persisting:

%% Sorry! The code lost its mind while executing a command.  Not your fault.
Please send this error information to the admins and tell them what you were doing at the time:
Description: "event"
Error: "undefined method `new' for :get_web_request_handler:Symbol
Did you mean?  next"

It pops up before every command I run on the game now, even the upgrade commands I was trying to run.

Not sure what I did here or why changing nickname field didn’t work for me to begin with :frowning:

1 Like

The nickname_format field only accepts two variables: %{name} for the player’s name, and %{nickname} for whatever you set as your nickname field (In your case, the code name). You can’t change those variables’ names, you can just change how they’re formatted.
%{name} (%{nickname})” or “%{name} -- %{nickname}” or whatever.

If that doesn’t solve your issue, I would need to see the detailed error logs, not just the message from the game. See Getting Log Files. It’ll have some code foo that pinpoints exactly what file and line number is having a problem.

You can PM the error to me if you don’t want to post it here.

I see, I didn’t realize nickname was the literal variable name – I thought it needed to also change to reflect the new demographic field. It works, but I’m still receiving that other error with all my commands.

The error in the log file isn’t very sensitive so I can just post it here:

2020-06-26 18:15:25 DEBUG - AresMUSH::Manage::ExamineCmd: ID=1 Enactor=Blues Cmd=examine me 
     

Did you mean?  next backtrace=["/home/ares/aresmush/engine/aresmush/commands/dispatcher.rb:97:in `block (3 levels) in on_command'", "/home/ares/aresmush/engine/aresmush/error_block.rb:6:in `with_error_handling'", "/home/ares/aresmush/engine/aresmush/commands/dispatcher.rb:93:in `block (2 levels) in on_command'", "/home/ares/aresmush/engine/aresmush/commands/dispatcher.rb:91:in `each'", "/home/ares/aresmush/engine/aresmush/commands/dispatcher.rb:91:in `block in on_command'", "/home/ares/aresmush/engine/aresmush/error_block.rb:6:in `with_error_handling'", "/home/ares/aresmush/engine/aresmush/commands/dispatcher.rb:156:in `with_error_handling'", "/home/ares/aresmush/engine/aresmush/commands/dispatcher.rb:82:in `on_command'", "/home/ares/aresmush/engine/aresmush/commands/dispatcher.rb:23:in `block (2 levels) in queue_command'", "/home/ares/aresmush/engine/aresmush/error_block.rb:6:in `with_error_handling'"] 
     

2020-06-26 18:15:25 ERROR - Error in examine me: client=1 error=undefined method `new' for :get_web_request_handler:Symbol
     

2020-06-26 18:15:22 DEBUG - AresMUSH::Describe::LookCmd: ID=1 Enactor=Blues Cmd=look 
     

Did you mean?  next backtrace=["/home/ares/aresmush/engine/aresmush/commands/dispatcher.rb:97:in `block (3 levels) in on_command'", "/home/ares/aresmush/engine/aresmush/error_block.rb:6:in `with_error_handling'", "/home/ares/aresmush/engine/aresmush/commands/dispatcher.rb:93:in `block (2 levels) in on_command'", "/home/ares/aresmush/engine/aresmush/commands/dispatcher.rb:91:in `each'", "/home/ares/aresmush/engine/aresmush/commands/dispatcher.rb:91:in `block in on_command'", "/home/ares/aresmush/engine/aresmush/error_block.rb:6:in `with_error_handling'", "/home/ares/aresmush/engine/aresmush/commands/dispatcher.rb:156:in `with_error_handling'", "/home/ares/aresmush/engine/aresmush/commands/dispatcher.rb:82:in `on_command'", "/home/ares/aresmush/engine/aresmush/commands/dispatcher.rb:23:in `block (2 levels) in queue_command'", "/home/ares/aresmush/engine/aresmush/error_block.rb:6:in `with_error_handling'"] 
     

2020-06-26 18:15:22 ERROR - Error in look: client=1 error=undefined method `new' for :get_web_request_handler:Symbol

It seems to happen with every command I can think of, including ‘examine’ and ‘events’ and ‘look.’

Did you add any custom code at all? Maybe a custom plugin with the goals tutorial or something? If so, could you let me know what’s in your aresmush/plugins/custom/custom.rb file?

Shoot, I did add stuff in my custom folder. I can PM you the link to the git repo if that is easier to read.