Skip to content

NoMethodError on line ["32"] lib/sass/rails/helpers.rb: undefined method '[]' for nil:NilClass #121

rmontgomery429 opened this Issue Oct 11, 2012 · 16 comments

10 participants


I'm running bundle exec compass compile -e production --force and I'm getting

NoMethodError on line ["32"] of /Users/rmontgomery429/.rvm/gems/ruby-1.9.3-p194@usertesting-orders/gems/sass-rails-3.2.5/lib/sass/rails/helpers.rb: undefined method '[]' for nil:NilClass

That code in question is this: lib/sass/rails/helpers.rb:32

31: def resolver
32:   options[:custom][:resolver]
33: end

I added a binding.pry to the resolver method and options[:custom] returns nil.

def resolver
  binding.pry if options[:custom].nil?

options.has_key? :custom returns false.


This could be related to Issue 98 #98


Ok. On a hunch, I enabled the asset pipeline. Now it seems to work. I think this is because the Resolver is not correctly enabled without it. It appears that the template_handler is not used at all without the asset pipeline being enabled. but it could also be something janky in compass... I'm not sure. Stil digging.

castus commented Nov 8, 2012


castus commented Nov 9, 2012

I found a simple workaround


We got the same error because we had image-url in a plain .css file. Renaming to .css.scss did the trick.
Thought I'd let you know.


lib/sass/rails/helpers.rb:L32 does not exist anymore, this functionality appears to have been farmed out to sprockets/sass_functions. Can this issue be closed?

The problem itself may still be around but the error signature will have moved to another place.

frodsan commented Apr 30, 2013

Closing here, because does not exist anymore. Feel free to re-open if persists.

@frodsan frodsan closed this Apr 30, 2013
edrex commented Jun 3, 2013

I don't understand. This is broken in Rails 3.2.13. Are you dropping support for Rails 3.2?


Confirming for SR 3.2.6 in Rails 3.2.14. It seems that loading a plain CSS with a font is the problem in my reproduction.


Apparent cause: I had "font-url" functions (asset-url instructions) in a plain CSS file. The stack trace/exception could be a little more helpful.

wiggly commented Nov 6, 2013

Just another data point, I hit this issue and have spent far too long trying to figure out that I accidentally put a sass helper function into a plan CSS file.

joallard commented Nov 6, 2013

Exactly my case from 2 months ago!

@domcleal domcleal pushed a commit to domcleal/katello that referenced this issue Dec 10, 2013
@xsuchy xsuchy fix building on F18
addressing several problems.
compass compile is dissabled because of

apipie is disabled because it tries to connect somewhere and fails to connect

This bit me the other day while I was trying to deploy to a staging env. I just tried to reproduce it with the latest rails (4.1.4) and sass-rails but I'm unable to repro it now. If anyone could provide me with a failing test app, I could spend time improving the exception message. Cheers.

wiggly commented Jul 16, 2014

Just tried to reproduce on a rails 3.2.15 / sass-rails 3.2.3 and a rails 4.1.1 / sass-rails 4.0.3 app and neither break but I am not using the exact code that was killing my app last time.


@wiggly Yeah, same problem here. Oh well! I'll keep an eye to see if it comes up again.

henrik commented Feb 26, 2015

I got this error trying to precompile assets in Rails 3 (with sass-rails-3.2.6) using Uglifier 2. Since Uglifier 2 is declared as backwards-incompatible, I guess it might simply be that these versions of these libs are incompatible. Rails 3 can't use a later version of sass-rails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.