"unknown error" on login, undefined method `password_algorithm='

i ran a phpbb3 migration on top of a known-good ‘template’ of /shared (as i have been doing a few times a week for a while now as i improve things), and then i couldn’t log in.

i got an “Unknown error” on the login dialog, and the console showed a 500 error on the POST. trying to change a password from rails or using admin:create task gave a error like this:

docker exec -it dc rake admin:create
Email:  testadmin123@example.com
Password:
Repeat password:
rake aborted!
NoMethodError: undefined method `password_algorithm=' for #<User id: nil, username: "d8b57755b12086606777", created_at: nil, updated_at: nil, name: nil, seen_notification_id: 0, last_posted_at: nil, password_hash: nil, salt: "7512e03d29d4990a0bce5dd9b5954adc", active: false, username_lower: "d8b57755b12086606777", last_seen_at: nil, admin: false, last_emailed_at: nil, trust_level: 0, approved: false, approved_by_id: nil, approved_at: nil, previous_visit_at: nil, suspended_at: nil, suspended_till: nil, date_of_birth: nil, views: 0, flag_level: 0, ip_address: nil, moderator: false, title: nil, uploaded_avatar_id: nil, locale: nil, primary_group_id: nil, registration_ip_address: nil, staged: false, first_seen_at: nil, silenced_till: nil, group_locked_trust_level: nil, manual_locked_trust_level: nil, secure_identifier: nil, flair_group_id: nil, last_seen_reviewable_id: nil>
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activemodel-7.0.4.3/lib/active_model/attribute_methods.rb:458:in `method_missing'
/var/www/discourse/app/models/user.rb:1882:in `ensure_password_is_hashed'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/callbacks.rb:400:in `block in make_lambda'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/callbacks.rb:199:in `block (2 levels) in halting'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/callbacks.rb:687:in `block (2 levels) in default_terminator'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/callbacks.rb:686:in `catch'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/callbacks.rb:686:in `block in default_terminator'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/callbacks.rb:200:in `block in halting'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/callbacks.rb:595:in `block in invoke_before'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/callbacks.rb:595:in `each'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/callbacks.rb:595:in `invoke_before'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/callbacks.rb:116:in `block in run_callbacks'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/callbacks.rb:138:in `run_callbacks'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/callbacks.rb:929:in `_run_save_callbacks'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/callbacks.rb:457:in `create_or_update'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/timestamp.rb:126:in `create_or_update'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/persistence.rb:615:in `save'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/validations.rb:47:in `save'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/transactions.rb:298:in `block in save'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/transactions.rb:354:in `block in with_transaction_returning_status'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activesupport-7.0.4.3/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/connection_adapters/abstract/database_statements.rb:316:in `transaction'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/transactions.rb:350:in `with_transaction_returning_status'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/transactions.rb:298:in `save'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/activerecord-7.0.4.3/lib/active_record/suppressor.rb:50:in `save'
/var/www/discourse/lib/tasks/admin.rake:87:in `block in <main>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Tasks: TOP => admin:create
(See full trace by running task with --trace)

rebuilding a few hours later fixed the issue. ever seen that before?

all’s well that ends well, but i thought it was weird.

Most likely you had a pending database migration when you tried to run admin:create. (the password_algorithm column was recently added to the users table)

4 Likes

interesting.

can you guess what triggered the migrations to finally happen? restarting didn’t fix it. waiting didn’t seem to fix it. rebuilding the container again did though.

Migrations are run when performing an upgrade via the admin UI, or when doing a rebuild.

1 Like

that makes sense. what happened was the container was newer than its /shared, so needed migrations hadn’t been applied yet.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.