I spent quite a while in the last few days trying to figure this error out and since there was no blogs or info on it online I felt compelled to write one. Basic setup is RHEL 6.5 with either Foreman 1.5 or Foreman 1.6. I'm using the Foreman rpm's and the Centos SCL repo for Ruby193.

Here's the error:

Started GET "/" for 10.100.128.63 at 2014-09-19 21:03:08 +0000

NoMethodError (undefined method `size' for nil:NilClass):

To fix this try clearing your browser cache/cookies or use a Private Browser session. This error was infuriating to figure out because of the very limited stack trace. So I ran the site under webrick which still only gave me this little stack trace:

Started GET "/" for 10.100.1.25 at 2014-09-19 22:47:22 +0000

NoMethodError (undefined method `size' for nil:NilClass):
  /usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/rack/thread_handler_extension.rb:77:in `process_request'
  /usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:140:in `accept_and_process_next_request'
  /usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/request_handler/thread_handler.rb:108:in `main_loop'
  /usr/lib/ruby/gems/1.8/gems/passenger-4.0.18/lib/phusion_passenger/request_handler.rb:441:in `block (3 levels) in start_threads'

Eventually I got the site to run in develop mode with --debug (exceedingly difficult) though and the browser side full stack trace had the real clue.

NoMethodError

undefined method `size' for nil:NilClass
Rails.root: /usr/share/foreman

Application Full Trace

rack (1.4.1) lib/rack/utils.rb:457:in `[]='
rack (1.4.1) lib/rack/utils.rb:76:in `block in parse_query'
rack (1.4.1) lib/rack/utils.rb:66:in `each'
rack (1.4.1) lib/rack/utils.rb:66:in `parse_query'
rack (1.4.1) lib/rack/request.rb:263:in `cookies'
rack (1.4.1) lib/rack/session/abstract/id.rb:254:in `extract_session_id'
actionpack (3.2.8) lib/action_dispatch/middleware/session/abstract_store.rb:51:in `block in extract_session_id'
actionpack (3.2.8) lib/action_dispatch/middleware/session/abstract_store.rb:55:in `stale_session_check!'
actionpack (3.2.8) lib/action_dispatch/middleware/session/abstract_store.rb:51:in `extract_session_id'
rack (1.4.1) lib/rack/session/abstract/id.rb:43:in `load_session_id!'
rack (1.4.1) lib/rack/session/abstract/id.rb:32:in `[]'
rack (1.4.1) lib/rack/session/abstract/id.rb:262:in `current_session_id'
rack (1.4.1) lib/rack/session/abstract/id.rb:268:in `session_exists?'
rack (1.4.1) lib/rack/session/abstract/id.rb:107:in `exists?'
rack (1.4.1) lib/rack/session/abstract/id.rb:122:in `load_for_read!'
rack (1.4.1) lib/rack/session/abstract/id.rb:64:in `has_key?'
actionpack (3.2.8) lib/action_dispatch/middleware/flash.rb:258:in `ensure in call'
actionpack (3.2.8) lib/action_dispatch/middleware/flash.rb:259:in `call'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/cookies.rb:339:in `call'
activerecord (3.2.8) lib/active_record/query_cache.rb:64:in `call'
activerecord (3.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `_run__3062187567662466012__call__827136857413921735__callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.8) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.8) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.8) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.8) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.8) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.8) lib/rails/engine.rb:479:in `call'
railties (3.2.8) lib/rails/application.rb:223:in `call'
railties (3.2.8) lib/rails/railtie/configurable.rb:30:in `method_missing'
rack (1.4.1) lib/rack/builder.rb:134:in `call'
rack (1.4.1) lib/rack/urlmap.rb:64:in `block in call'
rack (1.4.1) lib/rack/urlmap.rb:49:in `each'
rack (1.4.1) lib/rack/urlmap.rb:49:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.8) lib/rails/rack/debugger.rb:20:in `call'
railties (3.2.8) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
/opt/rh/ruby193/root/usr/share/ruby/webrick/httpserver.rb:138:in `service'
/opt/rh/ruby193/root/usr/share/ruby/webrick/httpserver.rb:94:in `run'
/opt/rh/ruby193/root/usr/share/ruby/webrick/server.rb:191:in `block in start_thread'

Notice that the trace is from where the middle layer looks for cookies. Thats what finally tipped me off that it was a browser side cookie issue. Who'd think that a browser side issue would give such a small unhelpful stacktrace...