Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby 3.1 / Rails 6.1 / Spring 4.3.0: "`initialize': Rails::Application is abstract, you cannot instantiate it directly. (RuntimeError)" #734

Open
Tracked by #1557
tagliala opened this issue Mar 13, 2025 · 3 comments

Comments

@tagliala
Copy link

Hello,

GitHub actions is getting this error when trying to update a Rails 6.1 application to Spring 4.3.

/home/runner/work/ruby3-rails6-bootstrap-heroku/ruby3-rails6-bootstrap-heroku/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.10/lib/rails/railtie.rb:229:in `initialize': Rails::Application is abstract, you cannot instantiate it directly. (RuntimeError)
	from /home/runner/work/ruby3-rails6-bootstrap-heroku/ruby3-rails6-bootstrap-heroku/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.10/lib/rails/engine.rb:441:in `initialize'
	from /home/runner/work/ruby3-rails6-bootstrap-heroku/ruby3-rails6-bootstrap-heroku/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.10/lib/rails/application.rb:12[9](https://github.com/diowa/ruby3-rails6-bootstrap-heroku/actions/runs/13832314292/job/38699222461?pr=1557#step:7:10):in `initialize'
	from /home/runner/work/ruby3-rails6-bootstrap-heroku/ruby3-rails6-bootstrap-heroku/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.10/lib/rails/railtie.rb:184:in `new'
	from /home/runner/work/ruby3-rails6-bootstrap-heroku/ruby3-rails6-bootstrap-heroku/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.[10](https://github.com/diowa/ruby3-rails6-bootstrap-heroku/actions/runs/13832314292/job/38699222461?pr=1557#step:7:11)/lib/rails/railtie.rb:184:in `instance'
	from /home/runner/work/ruby3-rails6-bootstrap-heroku/ruby3-rails6-bootstrap-heroku/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.10/lib/rails/application.rb:100:in `instance'
	from /home/runner/work/ruby3-rails6-bootstrap-heroku/ruby3-rails6-bootstrap-heroku/vendor/bundle/ruby/3.1.0/gems/railties-6.1.7.10/lib/rails/railtie.rb:206:in `method_missing'
	from /home/runner/work/ruby3-rails6-bootstrap-heroku/ruby3-rails6-bootstrap-heroku/vendor/bundle/ruby/3.1.0/gems/spring-4.3.0/lib/spring/application.rb:[12](https://github.com/diowa/ruby3-rails6-bootstrap-heroku/actions/runs/13832314292/job/38699222461?pr=1557#step:7:13)8:in `block in preload'
	from /home/runner/work/ruby3-rails6-bootstrap-heroku/ruby3-rails6-bootstrap-heroku/vendor/bundle/ruby/3.1.0/gems/spring-4.3.0/lib/spring/application.rb:127:in `each'
	from /home/runner/work/ruby3-rails6-bootstrap-heroku/ruby3-rails6-bootstrap-heroku/vendor/bundle/ruby/3.1.0/gems/spring-4.3.0/lib/spring/application.rb:127:in `preload'
	from /home/runner/work/ruby3-rails6-bootstrap-heroku/ruby3-rails6-bootstrap-heroku/vendor/bundle/ruby/3.1.0/gems/spring-4.3.0/lib/spring/application.rb:176:in `serve'
	from /home/runner/work/ruby3-rails6-bootstrap-heroku/ruby3-rails6-bootstrap-heroku/vendor/bundle/ruby/3.1.0/gems/spring-4.3.0/lib/spring/application.rb:158:in `block in run'
	from /home/runner/work/ruby3-rails6-bootstrap-heroku/ruby3-rails6-bootstrap-heroku/vendor/bundle/ruby/3.1.0/gems/spring-4.3.0/lib/spring/application.rb:152:in `loop'
	from /home/runner/work/ruby3-rails6-bootstrap-heroku/ruby3-rails6-bootstrap-heroku/vendor/bundle/ruby/3.1.0/gems/spring-4.3.0/lib/spring/application.rb:152:in `run'
	from /home/runner/work/ruby3-rails6-bootstrap-heroku/ruby3-rails6-bootstrap-heroku/vendor/bundle/ruby/3.1.0/gems/spring-4.3.0/lib/spring/application/boot.rb:25:in `<top (required)>'
	from <internal:/opt/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:[13](https://github.com/diowa/ruby3-rails6-bootstrap-heroku/actions/runs/13832314292/job/38699222461?pr=1557#step:7:14)6:in `require'
	from <internal:/opt/hostedtoolcache/Ruby/3.1.6/x64/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:136:in `require'
	from -e:1:in `<main>'

Ref: https://github.com/diowa/ruby3-rails6-bootstrap-heroku/actions/runs/13832314292/job/38699222461?pr=1557

There are no issues with 4.2.1

I've tried to bisect but I didn't succeed

This is also reproducible by running rails c

$ rails c
~/.rvm/gems/ruby-3.1.6/gems/railties-6.1.7.10/lib/rails/railtie.rb:229:in `initialize': Rails::Application is abstract, you cannot instantiate it directly. (RuntimeError)
@clucas
Copy link

clucas commented Mar 15, 2025

I am experiencing the same thing with Rails 6.1.7.10 and Ruby 3.1.5

@DanielGregolate
Copy link

DanielGregolate commented Mar 17, 2025

Same thing here, any fixes?

@nna774
Copy link

nna774 commented Mar 21, 2025

I'm experiencing the same issue with Rails 6.1.7.9 and Ruby 3.4.2. Upon reviewing the changes at v4.2.1...v4.3.0#diff-8079047024eafaf078a5ec33c6e989295d077b3306c92c168a4cc043c9f780b2R127-R131, I found that calling watcher.add Rails::Application.paths["config/initializers"].expanded raises this RuntimeError. However, I don't understand why this happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants