Skip to content

New zeitwerk integration breaks existing configuration for loading rails engines #1363

Description

@DanielHeath

As of 28eae0f , my app (which uses an engine), fails to load on rails (revision b945dfbb69c53c19575fd2c5d42c79ecb21196f7), with:

gems/zeitwerk-2.6.6/lib/zeitwerk/loader.rb:471:in `block (3 levels) in raise_if_conflicting_directory': loader (Zeitwerk::Error)

#<Zeitwerk::Loader:0x00007f15cd1145b0
 @autoloaded_dirs=[],
 @autoloads={},
 @collapse_dirs=#<Set: {}>,
 @collapse_glob_patterns=#<Set: {}>,
 @eager_load_exclusions=#<Set: {}>,
 @eager_loaded=false,
 @ignored_glob_patterns=#<Set: {}>,
 @ignored_paths=#<Set: {}>,
 @inflector=Rails::Autoloaders::Inflector,
 @initialized_at=2023-01-18 12:20:10.342387947 +1100,
 @logger=nil,
 @mutex=#<Thread::Mutex:0x00007f15cd11e150>,
 @mutex2=#<Thread::Mutex:0x00007f15cd11dd90>,
 @namespace_dirs={},
 @on_load_callbacks={},
 @on_setup_callbacks=[],
 @on_unload_callbacks={},
 @reloading_enabled=false,
 @roots={},
 @setup=true,
 @shadowed_files=#<Set: {}>,
 @tag="rails.once",
 @to_unload={}>


wants to manage directory vendor/cache/dbhero-31065fc1bd42/app/controllers, which is already managed by

<snip for sensitive / long>

	from gems/zeitwerk-2.6.6/lib/zeitwerk/loader.rb:465:in `each_key'
	from gems/zeitwerk-2.6.6/lib/zeitwerk/loader.rb:465:in `block (2 levels) in raise_if_conflicting_directory'
	from gems/zeitwerk-2.6.6/lib/zeitwerk/loader.rb:461:in `each'
	from gems/zeitwerk-2.6.6/lib/zeitwerk/loader.rb:461:in `block in raise_if_conflicting_directory'
	from gems/zeitwerk-2.6.6/lib/zeitwerk/loader.rb:458:in `synchronize'
	from gems/zeitwerk-2.6.6/lib/zeitwerk/loader.rb:458:in `raise_if_conflicting_directory'
	from gems/zeitwerk-2.6.6/lib/zeitwerk/loader/config.rb:123:in `push_dir'
	from <railsapp>/vendor/cache/tapioca-1b485c6ce47f/lib/tapioca/loaders/loader.rb:79:in `block in eager_load_engine'
	from <railsapp>/vendor/cache/tapioca-1b485c6ce47f/lib/tapioca/loaders/loader.rb:75:in `each'
	from <railsapp>/vendor/cache/tapioca-1b485c6ce47f/lib/tapioca/loaders/loader.rb:75:in `eager_load_engine'
	from <railsapp>/vendor/cache/tapioca-1b485c6ce47f/lib/tapioca/loaders/loader.rb:65:in `block (2 levels) in load_rails_engines'
	from <railsapp>/vendor/cache/tapioca-1b485c6ce47f/lib/tapioca/loaders/loader.rb:64:in `each'
	from <railsapp>/vendor/cache/tapioca-1b485c6ce47f/lib/tapioca/loaders/loader.rb:64:in `block in load_rails_engines'
	from <railsapp>/vendor/cache/tapioca-1b485c6ce47f/lib/tapioca/loaders/loader.rb:119:in `with_rails_application'
	from gems/sorbet-runtime-0.5.10626/lib/types/private/methods/_methods.rb:277:in `bind_call'
	from gems/sorbet-runtime-0.5.10626/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
	from <railsapp>/vendor/cache/tapioca-1b485c6ce47f/lib/tapioca/loaders/loader.rb:63:in `load_rails_engines'
	from gems/sorbet-runtime-0.5.10626/lib/types/private/methods/_methods.rb:277:in `bind_call'
	from gems/sorbet-runtime-0.5.10626/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
	from <railsapp>/vendor/cache/tapioca-1b485c6ce47f/lib/tapioca/loaders/loader.rb:33:in `load_bundle'
	from gems/sorbet-runtime-0.5.10626/lib/types/private/methods/_methods.rb:277:in `bind_call'
	from gems/sorbet-runtime-0.5.10626/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
	from <railsapp>/vendor/cache/tapioca-1b485c6ce47f/lib/tapioca/loaders/gem.rb:59:in `require_gem_file'
	from gems/sorbet-runtime-0.5.10626/lib/types/private/methods/_methods.rb:277:in `bind_call'
	from gems/sorbet-runtime-0.5.10626/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
	from <railsapp>/vendor/cache/tapioca-1b485c6ce47f/lib/tapioca/loaders/gem.rb:33:in `load'
	from gems/sorbet-runtime-0.5.10626/lib/types/private/methods/_methods.rb:277:in `bind_call'
	from gems/sorbet-runtime-0.5.10626/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
	from <railsapp>/vendor/cache/tapioca-1b485c6ce47f/lib/tapioca/loaders/gem.rb:27:in `load_application'
	from gems/sorbet-runtime-0.5.10626/lib/types/private/methods/_methods.rb:277:in `bind_call'
	from gems/sorbet-runtime-0.5.10626/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
	from <railsapp>/vendor/cache/tapioca-1b485c6ce47f/lib/tapioca/commands/gem.rb:243:in `block in perform_additions'
	from gems/thor-1.2.1/lib/thor/shell/basic.rb:44:in `indent'
	from <railsapp>/vendor/cache/tapioca-1b485c6ce47f/lib/tapioca/commands/gem.rb:239:in `perform_additions'
	from gems/sorbet-runtime-0.5.10626/lib/types/private/methods/_methods.rb:277:in `bind_call'
	from gems/sorbet-runtime-0.5.10626/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
	from <railsapp>/vendor/cache/tapioca-1b485c6ce47f/lib/tapioca/commands/gem.rb:115:in `sync'
	from gems/sorbet-runtime-0.5.10626/lib/types/private/methods/_methods.rb:277:in `bind_call'
	from gems/sorbet-runtime-0.5.10626/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
	from <railsapp>/vendor/cache/tapioca-1b485c6ce47f/lib/tapioca/cli.rb:266:in `block in gem'
	from <railsapp>/vendor/cache/tapioca-1b485c6ce47f/lib/tapioca.rb:23:in `block in silence_warnings'
	from /home/daniel/.rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/user_interaction.rb:46:in `use_ui'
	from <railsapp>/vendor/cache/tapioca-1b485c6ce47f/lib/tapioca.rb:22:in `silence_warnings'
	from gems/sorbet-runtime-0.5.10626/lib/types/private/methods/_methods.rb:277:in `bind_call'
	from gems/sorbet-runtime-0.5.10626/lib/types/private/methods/_methods.rb:277:in `block in _on_method_added'
	from <railsapp>/vendor/cache/tapioca-1b485c6ce47f/lib/tapioca/cli.rb:235:in `gem'
	from gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
	from gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
	from gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
	from gems/thor-1.2.1/lib/thor/base.rb:485:in `start'
	from <railsapp>/vendor/cache/tapioca-1b485c6ce47f/exe/tapioca:25:in `<top (required)>'
	from bin/tapioca:29:in `load'
	from bin/tapioca:29:in `<main>'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions