Error in "projects" page: ActionView::Template::Error (undefined method `name' for nil:NilClass)

Added by Matthieu Osef 7 months ago

Hi, on a web server I am maintaing there is an old version of Redmine that was installed years ago. It worked well, until a few weeks ago (I'm not sure when exactly but that may be since I upgraded Debian - the server is running Debian 9.6).

Now Redmine works only partly. You can login and see the main page and most pages normally, but some pages such as the "projects" page give a 500 error. Here is what the log file says about it:

Started GET "/projects" for **.**.**.** at 2018-11-28 10:34:39 +0100
Processing by ProjectsController#index as HTML
  Current user: *** (id=13)
  Rendered projects/index.html.erb within layouts/base (197.6ms)
Completed 500 Internal Server Error in 243ms

ActionView::Template::Error (undefined method `name' for nil:NilClass):
    14: <h2><%=l(:label_project_plural)%></h2>
    15: 
    16: <div id="projects-index">
    17: <%= render_project_hierarchy(@projects)%>
    18: </div>
    19: 
    20: <% if User.current.logged? %>
  app/views/projects/index.html.erb:17:in `_app_views_projects_index_html_erb___4401419193652751165_4011958273740'

I never used Redmine or Ruby, so I don't really know what I should do. I tried to edit the template file, but that doesn't change anything.

While googling, I found people who had similar errors because the version of Redmine was not compatible with the newest version of Ruby, so I downgraded it (I had 2.3.something and I tried 2.1.5 and 2.1.0), which didn't change anything either.

The "list of contact" pages also returns an error, but a different one:

Started GET "/contacts" for **.**.**.** at 2018-11-28 10:56:29 +0100
Processing by ContactsController#index as HTML
  Current user: *** (id=13)
Completed 500 Internal Server Error in 110ms

TypeError (no implicit conversion of nil into String):
  vendor/bundle/ruby/2.3.0/gems/arel-3.0.3/lib/arel.rb:40:in `initialize'
  vendor/bundle/ruby/2.3.0/gems/arel-3.0.3/lib/arel.rb:40:in `new'
  vendor/bundle/ruby/2.3.0/gems/arel-3.0.3/lib/arel.rb:40:in `sql'
  vendor/bundle/ruby/2.3.0/gems/activerecord-3.2.13/lib/active_record/associations/join_helper.rb:47:in `block in sanitize'
  vendor/bundle/ruby/2.3.0/gems/activerecord-3.2.13/lib/active_record/associations/join_helper.rb:45:in `map'
  vendor/bundle/ruby/2.3.0/gems/activerecord-3.2.13/lib/active_record/associations/join_helper.rb:45:in `sanitize'
  vendor/bundle/ruby/2.3.0/gems/activerecord-3.2.13/lib/active_record/associations/join_dependency/join_association.rb:99:in `block in join_to'
  vendor/bundle/ruby/2.3.0/gems/activerecord-3.2.13/lib/active_record/associations/join_dependency/join_association.rb:69:in `each'
  vendor/bundle/ruby/2.3.0/gems/activerecord-3.2.13/lib/active_record/associations/join_dependency/join_association.rb:69:in `each_with_index'
  vendor/bundle/ruby/2.3.0/gems/activerecord-3.2.13/lib/active_record/associations/join_dependency/join_association.rb:69:in `join_to'
  vendor/bundle/ruby/2.3.0/gems/activerecord-3.2.13/lib/active_record/relation/query_methods.rb:370:in `block in build_joins'
  vendor/bundle/ruby/2.3.0/gems/activerecord-3.2.13/lib/active_record/relation/query_methods.rb:369:in `each'
  vendor/bundle/ruby/2.3.0/gems/activerecord-3.2.13/lib/active_record/relation/query_methods.rb:369:in `build_joins'
  vendor/bundle/ruby/2.3.0/gems/activerecord-3.2.13/lib/active_record/relation/query_methods.rb:266:in `build_arel'
  vendor/bundle/ruby/2.3.0/gems/activerecord-3.2.13/lib/active_record/relation/query_methods.rb:260:in `arel'
  vendor/bundle/ruby/2.3.0/gems/activerecord-3.2.13/lib/active_record/relation/calculations.rb:204:in `perform_calculation'
  vendor/bundle/ruby/2.3.0/gems/activerecord-3.2.13/lib/active_record/relation/calculations.rb:159:in `calculate'
  vendor/bundle/ruby/2.3.0/gems/activerecord-3.2.13/lib/active_record/relation/calculations.rb:157:in `calculate'
  vendor/bundle/ruby/2.3.0/gems/activerecord-3.2.13/lib/active_record/relation/calculations.rb:58:in `count'
  plugins/redmine_contacts/app/models/crm_query.rb:154:in `object_count'
  plugins/redmine_contacts/app/controllers/contacts_controller.rb:72:in `index'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:167:in `process_action'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_controller/metal/rendering.rb:10:in `process_action'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/abstract_controller/callbacks.rb:18:in `block in process_action'
  vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:469:in `_run__2202968974797730789__process_action__3220721725743605223__callbacks'
  vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
  vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
  vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/abstract_controller/callbacks.rb:17:in `process_action'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_controller/metal/rescue.rb:29:in `process_action'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
  vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `block in instrument'
  vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.13/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.13/lib/active_support/notifications.rb:123:in `instrument'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_controller/metal/instrumentation.rb:29:in `process_action'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
  vendor/bundle/ruby/2.3.0/gems/activerecord-3.2.13/lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/abstract_controller/base.rb:121:in `process'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/abstract_controller/rendering.rb:45:in `process'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_controller/metal.rb:203:in `dispatch'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_controller/metal.rb:246:in `block in action'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:36:in `call'
  vendor/bundle/ruby/2.3.0/gems/journey-1.0.4/lib/journey/router.rb:68:in `block in call'
  vendor/bundle/ruby/2.3.0/gems/journey-1.0.4/lib/journey/router.rb:56:in `each'
  vendor/bundle/ruby/2.3.0/gems/journey-1.0.4/lib/journey/router.rb:56:in `call'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_dispatch/routing/route_set.rb:612:in `call'
  vendor/bundle/ruby/2.3.0/gems/rack-openid-1.4.2/lib/rack/openid.rb:98:in `call'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/etag.rb:23:in `call'
  vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/conditionalget.rb:25:in `call'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/head.rb:14:in `call'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/flash.rb:242:in `call'
  vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/session/abstract/id.rb:210:in `context'
  vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/session/abstract/id.rb:205:in `call'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/cookies.rb:341:in `call'
  vendor/bundle/ruby/2.3.0/gems/activerecord-3.2.13/lib/active_record/query_cache.rb:64:in `call'
  vendor/bundle/ruby/2.3.0/gems/activerecord-3.2.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `_run__2574543521333826179__call__889546917038081169__callbacks'
  vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:405:in `__run_callback'
  vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.13/lib/active_support/callbacks.rb:81:in `run_callbacks'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  vendor/bundle/ruby/2.3.0/gems/railties-3.2.13/lib/rails/rack/logger.rb:32:in `call_app'
  vendor/bundle/ruby/2.3.0/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `block in call'
  vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.13/lib/active_support/tagged_logging.rb:22:in `tagged'
  vendor/bundle/ruby/2.3.0/gems/railties-3.2.13/lib/rails/rack/logger.rb:16:in `call'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/request_id.rb:22:in `call'
  vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/methodoverride.rb:21:in `call'
  vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/runtime.rb:17:in `call'
  vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.13/lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  vendor/bundle/ruby/2.3.0/gems/rack-1.4.7/lib/rack/lock.rb:15:in `call'
  vendor/bundle/ruby/2.3.0/gems/actionpack-3.2.13/lib/action_dispatch/middleware/static.rb:63:in `call'
  vendor/bundle/ruby/2.3.0/gems/rack-cache-1.8.0/lib/rack/cache/context.rb:140:in `forward'
  vendor/bundle/ruby/2.3.0/gems/rack-cache-1.8.0/lib/rack/cache/context.rb:249:in `fetch'
  vendor/bundle/ruby/2.3.0/gems/rack-cache-1.8.0/lib/rack/cache/context.rb:189:in `lookup'
  vendor/bundle/ruby/2.3.0/gems/rack-cache-1.8.0/lib/rack/cache/context.rb:66:in `call!'
  vendor/bundle/ruby/2.3.0/gems/rack-cache-1.8.0/lib/rack/cache/context.rb:51:in `call'
  vendor/bundle/ruby/2.3.0/gems/railties-3.2.13/lib/rails/engine.rb:479:in `call'
  vendor/bundle/ruby/2.3.0/gems/railties-3.2.13/lib/rails/application.rb:223:in `call'
  vendor/bundle/ruby/2.3.0/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/rack/thread_handler_extension.rb:97:in `process_request'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:152:in `accept_and_process_next_request'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler/thread_handler.rb:113:in `main_loop'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/request_handler.rb:416:in `block (3 levels) in start_threads'
  /usr/lib/ruby/vendor_ruby/phusion_passenger/utils.rb:113:in `block in create_thread_and_abort_on_exception'

I don't know if it is normal that Redmine uses scripts in the ruby/2.3.0 directory when I'm running Ruby 2.1.0 (the ruby/2.1.0 directory exists as well).

Additional information:

Environment:
  Redmine version                2.3.4.stable
  Ruby version                   2.1.0-p0 (2013-12-25) [x86_64-linux]
  Rails version                  3.2.13
  Environment                    production
  Database adapter               Mysql2
Redmine plugins:
  progressive_projects_list      1.0.0
  project_section                0.0.2
  redmine_category_tree          0.0.5
  redmine_contacts               3.4.4
  redmine_meetings               0.2.6
  redmine_people                 0.1.8
  timelog_timer                  2.0.0

Replies (2)

RE: Error in "projects" page: ActionView::Template::Error (undefined method `name' for nil:NilClass) - Added by Go MAEDA 7 months ago

Redmine 2.3 was not tested with Ruby 2.1. Ruby 2.1 was supported by Redmine 2.5.2 (#16194).

The highest Ruby version supported by Redmine 2.3 is Ruby 2.0 (#13329).

RE: Error in "projects" page: ActionView::Template::Error (undefined method `name' for nil:NilClass) - Added by Matthieu Osef 7 months ago

Thank you for your answer. I installed Ruby 2.0.0 but the problem is still there.

(1-2/2)