Errors printing anything in rails console

Myself and some other devs saw the following error trying to execute anything in the rails console:

Traceback (most recent call last):
       16: from /home/vagrant/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/irb.rb:427:in `catch'
       15: from /home/vagrant/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/irb.rb:428:in `block in run'
       14: from /home/vagrant/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/irb.rb:487:in `eval_input'
       13: from /home/vagrant/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/irb/ruby-lex.rb:231:in `each_top_level_statement'
       12: from /home/vagrant/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/irb/ruby-lex.rb:231:in `catch'
       11: from /home/vagrant/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/irb/ruby-lex.rb:232:in `block in each_top_level_statement'
       10: from /home/vagrant/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/irb/ruby-lex.rb:232:in `loop'
        9: from /home/vagrant/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/irb/ruby-lex.rb:246:in `block (2 levels) in each_top_level_statement'
        8: from /home/vagrant/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/irb.rb:488:in `block in eval_input'
        7: from /home/vagrant/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/irb.rb:623:in `signal_status'
        6: from /home/vagrant/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/irb.rb:492:in `block (2 levels) in eval_input'
        5: from /home/vagrant/.rvm/gems/ruby-2.5.1/gems/hirb-0.7.3/lib/hirb/view.rb:187:in `output_value'
        4: from /home/vagrant/.rvm/gems/ruby-2.5.1/gems/hirb-0.7.3/lib/hirb/view.rb:201:in `view_or_page_output'
        3: from /home/vagrant/.rvm/gems/ruby-2.5.1/gems/hirb-0.7.3/lib/hirb/view.rb:219:in `page_output'
        2: from /home/vagrant/.rvm/gems/ruby-2.5.1/gems/hirb-0.7.3/lib/hirb/pager.rb:89:in `activated_by?'
        1: from /home/vagrant/.rvm/gems/ruby-2.5.1/gems/hirb-unicode-steakknife-0.0.8/lib/hirb/unicode/string_util.rb:5:in `size'
NoMethodError (undefined method `display_width' for #<String:0x000000000b840458>)
Did you mean?  display
Maybe IRB bug!

Its seen in Katello environments, but I’m not sure if its seen in standalone Foreman as well.

It can be worked around by doing the following:
Adding require 'unicode/display_width/string_ext' to the top of ~/.rvm/gems/ruby-2.5.1/gems/hirb-unicode-steakknife-0.0.8/lib/hirb/unicode/string_util.rb (assuming you use ruby 2.5.1)

However, I think we should probably come up with a more permanent solution. Does anyone have an idea of what introduced this and what we can do about it?

@shiramax also hit this yesterday… not sure about the origin, but perhaps it is time to move to defaulting to pry instead of irb? until we change the default, you can just add gem 'pry-rails' in your gemfile.

It happens to me also with pry. With Katello, not sure if standalone Foreman is affected too.