# Sidekiq email error: no implicit conversion of nil into String

**URL:** https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419
**Category:** Bug
**Created:** [March 2, 2016, 12:26am UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419 "2016-03-02T00:26:30Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![daath](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/daath/32/115536_2.png) [@daath](https://meta.discourse.org/u/daath)
#### Post date: [March 2, 2016, 12:26am UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419/1 "2016-03-02T00:26:30Z")

</div>

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:

 ![](https://global.discourse-cdn.com/meta/original/3X/b/a/ba3ca1de1970b5aeecdd18f2f9389dc4f693f653.png)

---

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [March 2, 2016, 4:12am UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419/2 "2016-03-02T04:12:08Z")

</div>

I’m getting the same thing..

this is in my /logs:

```plaintext
/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

```

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 2, 2016, 4:17am UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419/3 "2016-03-02T04:17:46Z")

</div>

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

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 2, 2016, 4:26am UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419/4 "2016-03-02T04:26:30Z")

</div>

What does this return?

```plaintext
./launcher enter app
rails c
> ColorScheme.hex_for_name('tertiary')

```

---

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [March 2, 2016, 4:39am UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419/5 "2016-03-02T04:39:03Z")

</div>

```plaintext
 ColorScheme.hex_for_name('tertiary')
=> "0088cc"

```

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 2, 2016, 4:43am UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419/6 "2016-03-02T04:43:26Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [March 2, 2016, 5:06am UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419/7 "2016-03-02T05:06:38Z")

</div>

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

---

<div class="post-metadata">

### Author: ![steko](https://avatars.discourse-cdn.com/v4/letter/s/c77e96/32.png) [@steko](https://meta.discourse.org/u/steko)
#### Post date: [March 8, 2016, 7:32pm UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419/8 "2016-03-08T19:32:23Z")

</div>

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

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [March 8, 2016, 10:54pm UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419/9 "2016-03-08T22:54:32Z")

</div>



---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [April 15, 2016, 5:28pm UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419/10 "2016-04-15T17:28:36Z")

</div>



---

<div class="post-metadata">

### Author: ![Sander78](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sander78/32/296615_2.png) [@Sander78](https://meta.discourse.org/u/Sander78)
#### Post date: [April 16, 2016, 5:12am UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419/11 "2016-04-16T05:12:48Z")

</div>

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

---

<div class="post-metadata">

### Author: ![danielfilho](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/danielfilho/32/114996_2.png) [@danielfilho](https://meta.discourse.org/u/danielfilho)
#### Post date: [April 18, 2016, 6:04am UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419/12 "2016-04-18T06:04:27Z")

</div>

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

---

<div class="post-metadata">

### Author: ![pjv](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pjv/32/115994_2.png) [@pjv](https://meta.discourse.org/u/pjv)
#### Post date: [April 19, 2016, 12:48pm UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419/13 "2016-04-19T12:48:22Z")

</div>

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

---

<div class="post-metadata">

### Author: ![h1onE](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/h1one/32/45349_2.png) [@h1onE](https://meta.discourse.org/u/h1onE)
#### Post date: [April 21, 2016, 4:04pm UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419/14 "2016-04-21T16:04:24Z")

</div>

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

---

<div class="post-metadata">

### Author: ![watchmanmonitor](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/watchmanmonitor/32/430970_2.png) [@watchmanmonitor](https://meta.discourse.org/u/watchmanmonitor)
#### Post date: [April 24, 2016, 10:08pm UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419/15 "2016-04-24T22:08:30Z")

</div>

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.

 ![](https://global.discourse-cdn.com/meta/original/3X/5/b/5bc7ec16ab4c9fc787355ac5b27c897929849415.png)

---

<div class="post-metadata">

### Author: ![georgiano](https://avatars.discourse-cdn.com/v4/letter/g/58956e/32.png) [@georgiano](https://meta.discourse.org/u/georgiano)
#### Post date: [April 26, 2016, 6:38pm UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419/16 "2016-04-26T18:38:45Z")

</div>

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

---

<div class="post-metadata">

### Author: ![tuttle](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tuttle/32/34114_2.png) [@tuttle](https://meta.discourse.org/u/tuttle)
#### Post date: [April 27, 2016, 8:53pm UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419/17 "2016-04-27T20:53:50Z")

</div>

Same here on 1.6.0.beta2

---

<div class="post-metadata">

### Author: ![joebuhlig](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joebuhlig/32/193054_2.png) [@joebuhlig](https://meta.discourse.org/u/joebuhlig)
#### Post date: [April 27, 2016, 9:09pm UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419/18 "2016-04-27T21:09:12Z")

</div>

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](https://github.com/discourse/discourse/commits/d59106cb1596f905386c262822ba140d884e756b/app/views/user_notifications/digest.html.erb), 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.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [April 28, 2016, 6:00am UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419/19 "2016-04-28T06:00:57Z")

</div>

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

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [April 28, 2016, 4:59pm UTC](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419/20 "2016-04-28T16:59:03Z")

</div>

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](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](https://github.com/discourse/discourse/blob/master/lib/email/styles.rb#L143) (`006699`).

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

[Next page](https://meta.discourse.org/t/sidekiq-email-error-no-implicit-conversion-of-nil-into-string/40419.md?page=2)
