Content
"uninitialized constant" error when trying to reset password with Rails console
Added by Keith Brautigam 9 days ago
I am running OpenProject Community Edition 16.3.1 with PostgreSQL 17.5.
I have lost access to my account and am attempting to reset it using the Rails console as described on this page:
https://www.openproject.org/docs/installation-and-operations/operation/faq/
However, I get an "uninitialized constant" error:
irb(main):001> user = User.find(1)
(irb):1:in '<main>': uninitialized constant User (NameError)
from <internal:kernel>:168:in 'Kernel#loop'
from /opt/openproject/vendor/bundle/ruby/3.4.0/gems/irb-1.15.2/exe/irb:9:in '<top (required)>'
from /opt/openproject/vendor/bundle/ruby/3.4.0/bin/irb:25:in 'Kernel#load'
from /opt/openproject/vendor/bundle/ruby/3.4.0/bin/irb:25:in '<top (required)>'
from /opt/openproject/vendor/ruby-3.4.5/lib/ruby/3.4.0/bundler/cli/exec.rb:59:in 'Kernel.load'
from /opt/openproject/vendor/ruby-3.4.5/lib/ruby/3.4.0/bundler/cli/exec.rb:59:in 'Bundler::CLI::Exec#kernel_load'
from /opt/openproject/vendor/ruby-3.4.5/lib/ruby/3.4.0/bundler/cli/exec.rb:23:in 'Bundler::CLI::Exec#run'
from /opt/openproject/vendor/ruby-3.4.5/lib/ruby/3.4.0/bundler/cli.rb:452:in 'Bundler::CLI#exec'
from /opt/openproject/vendor/ruby-3.4.5/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor/command.rb:28:in 'Bundler::Thor::Command#run'
from /opt/openproject/vendor/ruby-3.4.5/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in 'Bundler::Thor::Invocation#invoke_command'
from /opt/openproject/vendor/ruby-3.4.5/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor.rb:538:in 'Bundler::Thor.dispatch'
from /opt/openproject/vendor/ruby-3.4.5/lib/ruby/3.4.0/bundler/cli.rb:35:in 'Bundler::CLI.dispatch'
from /opt/openproject/vendor/ruby-3.4.5/lib/ruby/3.4.0/bundler/vendor/thor/lib/thor/base.rb:584:in 'Bundler::Thor::Base::ClassMethods#start'
from /opt/openproject/vendor/ruby-3.4.5/lib/ruby/3.4.0/bundler/cli.rb:29:in 'Bundler::CLI.start'
from /opt/openproject/vendor/ruby-3.4.5/lib/ruby/gems/3.4.0/gems/bundler-2.6.9/exe/bundle:28:in 'block in <top (required)>'
from /opt/openproject/vendor/ruby-3.4.5/lib/ruby/3.4.0/bundler/friendly_errors.rb:117:in 'Bundler.with_friendly_errors'
I would appreciate any suggestions. Thank you!
Replies (2)
Hello Keith,
that looks faily similar to a bug which has been recently reported:
While this has not been fixed yet, the report at least provides a workaround to open the console with this command and then perform the FAQ steps you mentioned:
sudo openproject run rails c
Best,
Alexander
Thank you very much Alex. This allows the script to work for resetting the password. As it turns out my issue is deeper (it doesn't find me... I think because somehow I have gotten two database schemas and it's using the one without me or any of my users). But what you suggested exactly answered what I asked, and thus I think this particular issue can be considered closed. Thank you again very much.