Greetings fellow chef users,
I have a question about how errors are printed in 10.14. I’m getting the classic -
FATAL: TypeError: can't convert nil into String which probably means I’m missing an attribute. The trouble is, I can’t find where the error is happening. If I look at the stacktrace it looks like it’s all coming from chef itself.
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/formatters/error_inspectors/compile_error_inspector.rb:72:in `readlines'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/formatters/error_inspectors/compile_error_inspector.rb:72:in `file_lines'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/formatters/error_inspectors/compile_error_inspector.rb:67:in `display_upper_bound'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/formatters/error_inspectors/compile_error_inspector.rb:51:in `context'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/formatters/error_inspectors/compile_error_inspector.rb:44:in `add_explanation'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/formatters/error_mapper.rb:80:in `file_load_failed'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/formatters/base.rb:174:in `file_load_failed'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/formatters/base.rb:230:in `recipe_file_load_failed'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/event_dispatch/dispatcher.rb:29:in `block in recipe_file_load_failed'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/event_dispatch/dispatcher.rb:29:in `each'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/event_dispatch/dispatcher.rb:29:in `recipe_file_load_failed'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/run_context.rb:85:in `rescue in block in load'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/run_context.rb:76:in `block in load'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/run_context.rb:75:in `each'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/run_context.rb:75:in `load'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/client.rb:198:in `setup_run_context'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/client.rb:418:in `do_run'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/client.rb:176:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/application/client.rb:283:in `block in run_application'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/application/client.rb:270:in `loop'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/application/client.rb:270:in `run_application'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/lib/chef/application.rb:70:in `run'
C:/opscode/chef/embedded/lib/ruby/gems/1.9.1/gems/chef-10.14.2/bin/chef-client:26:in `<top (required)>'
This doesn’t give me any clue to where my code to look where the nil is coming from.