Error printing in 10.14


#1

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:infile_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:incontext’
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:infile_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:inrecipe_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:ineach’
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:inrescue 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:ineach’
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:insetup_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:inrun’
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:inloop’
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:inrun’
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.

Kendrick Martin

Install Engineer

O: +1 503.553.2462

webtrendshttp://www.webtrends.com/

Real -Time Relevance. Remarkable ROI.™

London | Portland | San Francisco | Melbourne | Tokyo


#2

I believe you meant to say Ohai Chefs

Tim Smith

Operations Engineer, SaaS Operations

M: +1 707.738.8132

TW: @tas50

webtrendshttp://www.webtrends.com/

Real-Time Relevance. Remarkable ROI.™

London | Portland | San Francisco | Melbourne | Tokyo

From: Kendrick Martin <Kendrick.Martin@Webtrends.commailto:Kendrick.Martin@Webtrends.com>
Reply-To: "chef@lists.opscode.commailto:chef@lists.opscode.com" <chef@lists.opscode.commailto:chef@lists.opscode.com>
Date: Tuesday, September 18, 2012 2:38 PM
To: "chef@lists.opscode.commailto:chef@lists.opscode.com" <chef@lists.opscode.commailto:chef@lists.opscode.com>
Subject: [chef] Error printing in 10.14

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:infile_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:incontext’
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:infile_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:inrecipe_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:ineach’
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:inrescue 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:ineach’
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:insetup_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:inrun’
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:inloop’
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:inrun’
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.

Kendrick Martin

Install Engineer

O: +1 503.553.2462

webtrendshttp://www.webtrends.com/

Real -Time Relevance. Remarkable ROI.™

London | Portland | San Francisco | Melbourne | Tokyo


#3

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:infile_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:incontext’
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:infile_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:inrecipe_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:ineach’
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:inrescue 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:ineach’
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:insetup_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:inrun’
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:inloop’
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:inrun’
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.

It’s a bug in the error reporter, which is masking the real error in your recipe. Can you file a ticket please?


Daniel DeLeo


#4

CHEF-3461 created

From: Daniel DeLeo [mailto:ddeleo@kallistec.com] On Behalf Of Daniel DeLeo
Sent: Tuesday, September 18, 2012 3:08 PM
To: chef@lists.opscode.com
Subject: [chef] Re: Re: Error printing in 10.14

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.
It’s a bug in the error reporter, which is masking the real error in your recipe. Can you file a ticket please?


Daniel DeLeo


#5

On Tuesday, September 18, 2012 at 3:16 PM, Kendrick Martin wrote:

CHEF-3461 created

I added some debugging to the error reporting in a patch for a similar issue:

https://github.com/opscode/chef/compare/10-stable...CHEF-3456

If you have a moment to try the patch with -ldebug and post the output here or on the ticket, that would help a lot.

Thanks,


Daniel DeLeo

From: Daniel DeLeo [mailto:ddeleo@kallistec.com] On Behalf Of Daniel DeLeo
Sent: Tuesday, September 18, 2012 3:08 PM
To: chef@lists.opscode.com (mailto:chef@lists.opscode.com)
Subject: [chef] Re: Re: Error printing in 10.14

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.


#6

Patched and added the new stack trace to my ticket, CHEF-3461

This looks much better; line numbers are shown in my recipe where the attributes were nil.

Thanks,
Kendrick
From: Daniel DeLeo [mailto:ddeleo@kallistec.com] On Behalf Of Daniel DeLeo
Sent: Wednesday, September 19, 2012 1:12 PM
To: chef@lists.opscode.com
Subject: [chef] Re: RE: Re: Re: Error printing in 10.14

On Tuesday, September 18, 2012 at 3:16 PM, Kendrick Martin wrote:

CHEF-3461 created

I added some debugging to the error reporting in a patch for a similar issue:

https://github.com/opscode/chef/compare/10-stable...CHEF-3456

If you have a moment to try the patch with -ldebug and post the output here or on the ticket, that would help a lot.

Thanks,


Daniel DeLeo

From: Daniel DeLeo [mailto:ddeleo@kallistec.com] On Behalf Of Daniel DeLeo
Sent: Tuesday, September 18, 2012 3:08 PM
To: chef@lists.opscode.commailto:chef@lists.opscode.com
Subject: [chef] Re: Re: Error printing in 10.14

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.


#7

On Wednesday, September 19, 2012 at 1:40 PM, Kendrick Martin wrote:

Patched and added the new stack trace to my ticket, CHEF-3461

This looks much better; line numbers are shown in my recipe where the attributes were nil.

It looks like some stack traces are showing the drive letter as lowercase, and some as uppercase, and the code that’s trying to extract the filename from the stack trace expected only uppercase. I have no idea why this would be the case, but can you see if this patch solves the issue?

https://github.com/opscode/chef/compare/10-stable...CHEF-3461

Thanks in advance,


Daniel DeLeo


#8

That patch now shows the relevant file data where the bug occurred.
Is this path going to be included in a 10.14.4 release sometime soon?

Thanks for your help,
Kendrick

From: Daniel DeLeo [mailto:ddeleo@kallistec.com] On Behalf Of Daniel DeLeo
Sent: Wednesday, September 19, 2012 2:20 PM
To: chef@lists.opscode.com
Subject: [chef] Re: RE: Re: RE: Re: Re: Error printing in 10.14

On Wednesday, September 19, 2012 at 1:40 PM, Kendrick Martin wrote:

Patched and added the new stack trace to my ticket, CHEF-3461

This looks much better; line numbers are shown in my recipe where the attributes were nil.

It looks like some stack traces are showing the drive letter as lowercase, and some as uppercase, and the code that’s trying to extract the filename from the stack trace expected only uppercase. I have no idea why this would be the case, but can you see if this patch solves the issue?

https://github.com/opscode/chef/compare/10-stable...CHEF-3461

Thanks in advance,


Daniel DeLeo


#9

On Thursday, September 20, 2012 at 10:52 AM, Kendrick Martin wrote:

That patch now shows the relevant file data where the bug occurred.
Is this path going to be included in a 10.14.4 release sometime soon?

Thanks for your help,
Kendrick
Woohoo! I’ll merge it shortly and it will be in a 10.14.4 release, which will come out as soon as we fix a few remaining regressions.

Thanks for all your help testing these patches, really appreciate it.


Daniel DeLeo