Discourse AI causing rebuild to fail

With the latest build the rebuild fails on my site, the only way to get it to rebuild succesfully is by removing the AI plugin, any ideas?

Error

Caused by:

PG::InsufficientPrivilege: ERROR:  must be owner of extension vector (PG::InsufficientPrivilege)
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rack-mini-profiler-3.3.1/lib/patches/db/pg.rb:110:in `exec'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rack-mini-profiler-3.3.1/lib/patches/db/pg.rb:110:in `async_exec'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/mini_sql-1.6.0/lib/mini_sql/postgres/connection.rb:217:in `run'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/mini_sql-1.6.0/lib/mini_sql/active_record_postgres/connection.rb:38:in `block in run'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/mini_sql-1.6.0/lib/mini_sql/active_record_postgres/connection.rb:34:in `block in with_lock'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-7.1.4/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/mini_sql-1.6.0/lib/mini_sql/active_record_postgres/connection.rb:34:in `with_lock'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/mini_sql-1.6.0/lib/mini_sql/active_record_postgres/connection.rb:38:in `run'
/var/www/discourse/lib/mini_sql_multisite_connection.rb:109:in `run'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/mini_sql-1.6.0/lib/mini_sql/postgres/connection.rb:196:in `exec'
/var/www/discourse/plugins/discourse-ai/db/migrate/20240611170904_upgrade_pgvector_070.rb:10:in `up'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:989:in `public_send'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:989:in `exec_migration'
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `block in exec_migration'
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `exec_migration'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:970:in `block (2 levels) in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:969:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:227:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:968:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1178:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1529:in `block in execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:535:in `block in within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-7.1.4/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:532:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:344:in `transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1580:in `ddl_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1528:in `execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1503:in `each'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1503:in `migrate_without_lock'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1448:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1600:in `with_advisory_lock'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1448:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1274:in `up'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/migration.rb:1249:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.1.4/lib/active_record/tasks/database_tasks.rb:251:in `migrate'
/var/www/discourse/lib/tasks/db.rake:259:in `block (2 levels) in <main>'
/var/www/discourse/lib/distributed_mutex.rb:53:in `block in synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:49:in `synchronize'
/var/www/discourse/lib/distributed_mutex.rb:34:in `synchronize'
/var/www/discourse/lib/tasks/db.rake:234:in `block in <main>'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.2.1/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I, [2024-09-26T02:33:15.511637 #1]  INFO -- : gem install tokenizers -v 0.4.4 -i /var/www/discourse/plugins/discourse-ai/gems/3.3.4 --no-document --ignore-dependencies --no-user-install
Successfully installed tokenizers-0.4.4-x86_64-linux
1 gem installed
gem install tiktoken_ruby -v 0.0.9 -i /var/www/discourse/plugins/discourse-ai/gems/3.3.4 --no-document --ignore-dependencies --no-user-install
Successfully installed tiktoken_ruby-0.0.9-x86_64-linux
1 gem installed
gem install multipart-post -v 2.4.0 -i /var/www/discourse/plugins/discourse-chatbot/gems/3.3.4 --no-document --ignore-dependencies --no-user-install
Successfully installed multipart-post-2.4.0
1 gem installed
gem install faraday-multipart -v 1.0.4 -i /var/www/discourse/plugins/discourse-chatbot/gems/3.3.4 --no-document --ignore-dependencies --no-user-install
Successfully installed faraday-multipart-1.0.4
1 gem installed
gem install event_stream_parser -v 1.0.0 -i /var/www/discourse/plugins/discourse-chatbot/gems/3.3.4 --no-document --ignore-dependencies --no-user-install
Successfully installed event_stream_parser-1.0.0
1 gem installed
gem install ruby-openai -v 7.0.0 -i /var/www/discourse/plugins/discourse-chatbot/gems/3.3.4 --no-document --ignore-dependencies --no-user-install
Successfully installed ruby-openai-7.0.0
1 gem installed
gem install google_search_results -v 2.2.0 -i /var/www/discourse/plugins/discourse-chatbot/gems/3.3.4 --no-document --ignore-dependencies --no-user-install
Successfully installed google_search_results-2.2.0
1 gem installed
gem install wikipedia-client -v 1.17.0 -i /var/www/discourse/plugins/discourse-chatbot/gems/3.3.4 --no-document --ignore-dependencies --no-user-install
Successfully installed wikipedia-client-1.17.0
1 gem installed
gem install childprocess -v 5.0.0 -i /var/www/discourse/plugins/discourse-chatbot/gems/3.3.4 --no-document --ignore-dependencies --no-user-install
Successfully installed childprocess-5.0.0
1 gem installed
gem install liquid -v 5.5.0 -i /var/www/discourse/plugins/discourse-custom-wizard/gems/3.3.4 --no-document --ignore-dependencies --no-user-install
Successfully installed liquid-5.5.0
1 gem installed
gem install discourse_subscription_client -v 0.1.2 -i /var/www/discourse/plugins/discourse-custom-wizard/gems/3.3.4 --no-document --ignore-dependencies --no-user-install
Successfully installed discourse_subscription_client-0.1.2
1 gem installed
gem install discourse_plugin_statistics -v 0.1.0.pre7 -i /var/www/discourse/plugins/discourse-custom-wizard/gems/3.3.4 --no-document --ignore-dependencies --no-user-install
Successfully installed discourse_plugin_statistics-0.1.0.pre7
1 gem installed
gem install geocoder -v 1.8.2 -i /var/www/discourse/plugins/discourse-locations/gems/3.3.4 --no-document --ignore-dependencies --no-user-install
Successfully installed geocoder-1.8.2
1 gem installed
gem install aws-sdk-translate -v 1.35.0 -i /var/www/discourse/plugins/discourse-translator/gems/3.3.4 --no-document --ignore-dependencies --no-user-install
Successfully installed aws-sdk-translate-1.35.0
1 gem installed
== 20240611170904 UpgradePgvector070: migrating ===============================



FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 1936 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"cd"=>"$home", "tag"=>"migrate", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.
981f5a5797fa920052c5f2e33e4a36d4e515a053d5e922ca91882d0712379d3b
x86_64 arch detected.
881912b282ea
Nothing to do, your container has already started!

The error reminds me of Broken update: ERROR: must be owner of extension vector (PG::InsufficientPrivilege)

3 Likes

Interesting, thanks! It is a two container setup. @pfaffman I’ll probably need your help on this at some point, it’s very low priority though.

Hey David.

I’m pretty sure that the problem is that the data container needs to be rebuilt. If you rebuild frrom https://dashboard.literatecomputing.com/ it should handle that for you with a single click. I have recently added checks to rebuild the data container if pgvector isn’t the required version.

Your docker version is up to date, so it should work just fine.

Or let me know and I’ll click that button for you.

4 Likes

Thank you Jay! One of these days I’ll get out of the habit of using the command line and trust your button :wink::man_facepalming:t3:

2 Likes

Well, I’m about as command-line as they come, and the nice thing about the dashboard is that it runs an ansible script that does a whole bunch of stuff that people are likely to forget like doing a cleanup when disk gets tight, noticing that it’s time for a postgres upgrade (or in this case to just do a simple rebuild as opposed to a full version rebuild which takes a couple of rebuilds). It even shuts down the web container, rebuilds data, then starts up the web container before it goes on to doing the bootstrap.

Oh! And it knows about some plugins that are deprecated or moved to core, and removes those automatically.

But if you really like doing extra work and just mindlessly staring and computers do things (like I do), you can log in at the command line while it’s doing the upgrade and do a

docker logs -f container-name

to watch it do the bootstrap. If you tab twice for the container name, you’ll see the silly random name that docker assigns.

Cheers

2 Likes

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