Sidekiq email error: no implicit conversion of nil into String

I suddenly got a whole bunch of these errors after I updated last:

Jobs::HandledExceptionWrapper: Wrapped ActionView::Template::Error: no implicit conversion of nil into String

Screenshot:

2 Likes

I’m getting the same thing…

this is in my /logs:

/var/www/discourse/app/views/user_notifications/digest.html.erb:76:in `+'
/var/www/discourse/app/views/user_notifications/digest.html.erb:76:in `_app_views_user_notifications_digest_html_erb__4452730389243201084_70167469511260'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.5.1/lib/action_view/template.rb:145:in `block in render'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.5.1/lib/active_support/notifications.rb:164:in `block in instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.5.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.5.1/lib/active_support/notifications.rb:164:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.5.1/lib/action_view/template.rb:333:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.5.1/lib/action_view/template.rb:143:in `render'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/rack-mini-profiler-0.9.8/lib/mini_profiler/profiling_methods.rb:77:in `block in profile_method'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.5.1/lib/action_view/renderer/template_renderer.rb:54:in `block (2 levels) in render_template'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.5.1/lib/action_view/renderer/abstract_renderer.rb:39:in `block in instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.5.1/lib/active_support/notifications.rb:164:in `block in instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.5.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.5.1/lib/active_support/notifications.rb:164:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.5.1/lib/action_view/renderer/abstract_renderer.rb:39:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.5.1/lib/action_view/renderer/template_renderer.rb:53:in `block in render_template'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.5.1/lib/action_view/renderer/template_renderer.rb:61:in `render_with_layout'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.5.1/lib/action_view/renderer/template_renderer.rb:52:in `render_template'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.5.1/lib/action_view/renderer/template_renderer.rb:14:in `render'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.5.1/lib/action_view/renderer/renderer.rb:42:in `render_template'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.5.1/lib/action_view/renderer/renderer.rb:23:in `render'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.5.1/lib/action_view/rendering.rb:100:in `_render_template'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.5.1/lib/action_view/rendering.rb:83:in `render_to_body'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.5.1/lib/abstract_controller/rendering.rb:25:in `render'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.5.1/lib/action_mailer/base.rb:904:in `block in collect_responses'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.5.1/lib/action_mailer/base.rb:918:in `each'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.5.1/lib/action_mailer/base.rb:918:in `each_template'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.5.1/lib/action_mailer/base.rb:900:in `collect_responses'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.5.1/lib/action_mailer/base.rb:829:in `mail'
/var/www/discourse/lib/email/message_builder.rb:9:in `build_email'
/var/www/discourse/app/mailers/user_notifications.rb:92:in `digest'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.5.1/lib/abstract_controller/base.rb:198:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.5.1/lib/abstract_controller/callbacks.rb:20:in `block in process_action'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:88:in `__run_callbacks__'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:778:in `_run_process_action_callbacks'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.5.1/lib/active_support/callbacks.rb:81:in `run_callbacks'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.5.1/lib/abstract_controller/callbacks.rb:19:in `process_action'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionpack-4.2.5.1/lib/abstract_controller/base.rb:137:in `process'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionview-4.2.5.1/lib/action_view/rendering.rb:30:in `process'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.5.1/lib/action_mailer/base.rb:596:in `block in process'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.5.1/lib/active_support/notifications.rb:164:in `block in instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.5.1/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/activesupport-4.2.5.1/lib/active_support/notifications.rb:164:in `instrument'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.5.1/lib/action_mailer/base.rb:593:in `process'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.5.1/lib/action_mailer/base.rb:584:in `initialize'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.5.1/lib/action_mailer/message_delivery.rb:25:in `new'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/actionmailer-4.2.5.1/lib/action_mailer/message_delivery.rb:25:in `__getobj__'
/usr/local/lib/ruby/2.0.0/delegate.rb:70:in `method_missing'
/var/www/discourse/lib/email/sender.rb:30:in `send'
/var/www/discourse/app/jobs/regular/user_email.rb:41:in `execute'
/var/www/discourse/app/jobs/base.rb:154:in `block (2 levels) in perform'
infobacktraceenvSolve  Delete  Protect Share

aha looks like a change we pulled in via @joebuhlig regarding setting colors for links… having a look at patching it.

1 Like

What does this return?

./launcher enter app
rails c
> ColorScheme.hex_for_name('tertiary')
 ColorScheme.hex_for_name('tertiary')
=> "0088cc"

Weird … can you do a full rebuild?

Then try triggering digests in scheduled jobs under /sidekiq does the issue go away?

What could somehow happen is that an old sidekiq is somehow running using the old code that was not loading up that value.

5 Likes

the full rebuild seemed to work… the jobs I’ve retried are being sent

2 Likes

Today I had the same exact problem and after a rebuild sidekiq started working normally again.

2 Likes

I’m afraid this problem still persists… Latest commit and multiple rebuilds didn’t help.

same for me.
tried to rebuild, but problem persists.

I just experienced this immediately after (and as far as I can tell, as a result of) a rebuild.

I have the same problem… After updating to latest my errors seem to be gone.

1 Like

These just came back on one of my instances, updating to latest didn’t help, I have rebuilt since the first time I found them… if not more than once.

Have exactly same problem afrer updating to 1.5.1
Rebuild does not help
:frowning:

Same here on 1.6.0.beta2

I’m not real familiar with how Sidekiq works on the emails but it seems like it’s queueing up the email and sending it later. Because there’s been a lot of work on the digests lately, is it possible that the queued email is trying to use new or updated methods on send? That’s my best guess at this. I’m simply hoping this triggers an idea for someone who knows it better.

3 Likes

I will try to repro this issue and push a fix. Added on my list.

2 Likes

Even though I am unable to repro this issue locally or on a test instance (before/after rebuild), I just pushed a fix that will solve no implicit conversion of nil into String issue:

https://github.com/discourse/discourse/commit/2a2b0d780346542d8a8389ab5cc09110269c7149

The above fix will prevent raising exception and will ensure that digest email is sent even if @anchor_color is nil. Anchor color will fallback to default color (006699).

This is not a definitive fix, as I am not sure why Sidekiq is not loading @anchor_color's value in some cases.

7 Likes