railsadminteam/rails_admin

Constant Loading is already suppressed (RuntimeError)

aijkoopmans opened this issue · 2 comments

Describe the bug
When running my application after updating from 3.0.0 to 3.1.4 it throws Constant Loading is already suppressed (RuntimeError). It happens in development, production and test environments.

Reproduction steps
Update to 3.1.0 or higher

Expected behavior
No errors

Additional context

  • rails version: 7.0.8.1
  • rails_admin version: 3.1.4
  • rails_admin npm package version:
  • full stack trace (if there's an exception)
=> Rails 7.0.8.4 application starting in development 
=> Run `bin/rails server --help` for more startup options
Exiting
/Users/user1/.rvm/gems/ruby-3.1.2/gems/rails_admin-3.1.4/lib/rails_admin/config/const_load_suppressor.rb:10:in `suppressing': Constant Loading is already suppressed (RuntimeError)
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/rails_admin-3.1.4/lib/rails_admin.rb:35:in `config'
	from /Users/user1/Local/GitHub/project1/config/initializers/rails_admin.rb:27:in `block in <main>'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/rails_admin-3.1.4/lib/rails_admin.rb:35:in `block in config'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/rails_admin-3.1.4/lib/rails_admin/config/const_load_suppressor.rb:15:in `suppressing'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/rails_admin-3.1.4/lib/rails_admin.rb:35:in `config'
	from /Users/user1/Local/GitHub/project1/config/initializers/rails_admin.rb:1:in `<main>'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:39:in `load'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:39:in `load'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/railties-7.0.8.4/lib/rails/engine.rb:667:in `block in load_config_initializer'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/activesupport-7.0.8.4/lib/active_support/notifications.rb:208:in `instrument'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/railties-7.0.8.4/lib/rails/engine.rb:666:in `load_config_initializer'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/railties-7.0.8.4/lib/rails/engine.rb:620:in `block (2 levels) in <class:Engine>'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/railties-7.0.8.4/lib/rails/engine.rb:619:in `each'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/railties-7.0.8.4/lib/rails/engine.rb:619:in `block in <class:Engine>'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/railties-7.0.8.4/lib/rails/initializable.rb:32:in `instance_exec'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/railties-7.0.8.4/lib/rails/initializable.rb:32:in `run'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/railties-7.0.8.4/lib/rails/initializable.rb:61:in `block in run_initializers'
	from /Users/user1/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each'
	from /Users/user1/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	from /Users/user1/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
	from /Users/user1/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from'
	from /Users/user1/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/railties-7.0.8.4/lib/rails/initializable.rb:50:in `each'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/railties-7.0.8.4/lib/rails/initializable.rb:50:in `tsort_each_child'
	from /Users/user1/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:415:in `call'
	from /Users/user1/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:415:in `each_strongly_connected_component_from'
	from /Users/user1/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component'
	from /Users/user1/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `each'
	from /Users/user1/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `call'
	from /Users/user1/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component'
	from /Users/user1/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each'
	from /Users/user1/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/railties-7.0.8.4/lib/rails/initializable.rb:60:in `run_initializers'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/railties-7.0.8.4/lib/rails/application.rb:372:in `initialize!'
	from /Users/user1/Local/GitHub/project1/config/environment.rb:5:in `<main>'
	from config.ru:3:in `require_relative'
	from config.ru:3:in `block in <main>'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/rack-2.2.9/lib/rack/builder.rb:116:in `eval'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/rack-2.2.9/lib/rack/builder.rb:116:in `new_from_string'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/rack-2.2.9/lib/rack/builder.rb:105:in `load_file'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/rack-2.2.9/lib/rack/builder.rb:66:in `parse_file'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/rack-2.2.9/lib/rack/server.rb:349:in `build_app_and_options_from_config'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/rack-2.2.9/lib/rack/server.rb:249:in `app'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/rack-2.2.9/lib/rack/server.rb:422:in `wrapped_app'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/railties-7.0.8.4/lib/rails/commands/server/server_command.rb:76:in `log_to_stdout'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/railties-7.0.8.4/lib/rails/commands/server/server_command.rb:36:in `start'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/railties-7.0.8.4/lib/rails/commands/server/server_command.rb:143:in `block in perform'
	from <internal:kernel>:90:in `tap'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/railties-7.0.8.4/lib/rails/commands/server/server_command.rb:134:in `perform'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/thor-1.3.1/lib/thor/command.rb:28:in `run'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/thor-1.3.1/lib/thor/invocation.rb:127:in `invoke_command'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/thor-1.3.1/lib/thor.rb:527:in `dispatch'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/railties-7.0.8.4/lib/rails/command/base.rb:87:in `perform'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/railties-7.0.8.4/lib/rails/command.rb:48:in `invoke'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/railties-7.0.8.4/lib/rails/commands.rb:18:in `<main>'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /Users/user1/.rvm/gems/ruby-3.1.2/gems/bootsnap-1.12.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	from /Users/user1/Local/GitHub/project1/bin/rails:4:in `<main>'```

What do you have in config/initializers/rails_admin.rb? Can you paste it here?

Thanks for pointing me in the right the direction. I defined another RailsAdmin.config do |config| within itself. My bad.