Skip to content

Zeitwerk eager-load crashes with "uninitialized constant WorkOS::Inflections" in 7.0.0 #459

@yaakov-sanders

Description

@yaakov-sanders

Summary

In workos 7.0.0, any call to Zeitwerk::Loader.eager_load_all crashes with NameError: uninitialized constant WorkOS::Inflections. This breaks Rails production boot when config.eager_load = true and any tooling that globally
eager-loads (e.g. Tapioca, Sorbet setup).

Reproduction

gem install workos -v 7.0.0
ruby -rworkos -e 'Zeitwerk::Loader.eager_load_all'

Output:

…/zeitwerk-2.7.5/lib/zeitwerk/cref.rb:62:in 'Module#const_get':
uninitialized constant WorkOS::Inflections (NameError)
    @mod.const_get(@cname, false)

Expected

eager_load_all succeeds.

Actual

It raises because the gem's Zeitwerk loader expects lib/workos/inflections.rb to define WorkOS::Inflections, but the file
actually defines a top-level WORKOS_INFLECTIONS constant (which is then passed to loader.inflector.inflect(...)).

Proposed fix

Ignore inflections.rb in the loader setup, right next to the existing errors.rb ignore in lib/workos.rb:

loader.ignore("#{__dir__}/workos/errors.rb")
loader.ignore("#{__dir__}/workos/inflections.rb")  # add this
loader.setup

The file is already loaded explicitly via require_relative "workos/inflections" earlier in lib/workos.rb, so ignoring it in
Zeitwerk is the correct pattern.

Environment

  • workos 7.0.0
  • zeitwerk 2.7.5 (latest)
  • Ruby: 4.0.2

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