Reconstrução do Discourse falha com TypeError: can't quote Array

/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>'

Caused by:
TypeError: can't quote Array (TypeError)

        else raise TypeError, "can't quote #{value.class.name}"
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/quoting.rb:87:in `quote'
Pups::ExecError: cd /var/www/discourse & su discourse -c 'bundle exec rake db:migrate' falhou com retorno #<Process::Status: pid 765 exit 1>
Localização da falha: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec falhou com os parâmetros {"cd"=>"$home", "tag"=>"migrate", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap falhou com código de saída 1

Estou recebendo este erro em uma reconstrução (depois que uma tentativa de /admin/update estava falhando, tentei uma reconstrução normal).

Algum conselho?

Você pode compartilhar uma parte maior do log?

Algumas descobertas:

  • Isso está relacionado? O erro final é exatamente o mesmo.
  • Não funciona apenas com plugins oficiais
  • Parece funcionar com todos os plugins, exceto com o docker_manager desabilitado.

Hmm, parece que ele falha bem no início:

761:C 21 Jan 2025 18:15:11.783 # oO0OoO0OoO0Oo Redis está iniciando oO0OoO0OoO0Oo
761:C 21 Jan 2025 18:15:11.783 # Versão do Redis=7.0.15, bits=64, commit=00000000, modificado=0, pid=761, recém-iniciado
761:C 21 Jan 2025 18:15:11.783 # Configuração carregada
761:M 21 Jan 2025 18:15:11.784 * Relógio monotônico: POSIX clock_gettime
761:M 21 Jan 2025 18:15:11.784 # Aviso: Não foi possível criar o socket TCP de escuta do servidor *:6379: bind: Endereço já em uso
761:M 21 Jan 2025 18:15:11.784 # Falha ao escutar na porta 6379 (TCP), abortando.
I, [2025-01-21T18:15:21.774268 #1]  INFO -- : 
I, [2025-01-21T18:15:21.774557 #1]  INFO -- : > cd /var/www/discourse & su discourse -c 'bundle exec rake db:migrate'
rake aborted!
StandardError: Ocorreu um erro, esta e todas as migrações posteriores foram canceladas: (StandardError)

não é possível citar Array
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/quoting.rb:87:in `quote'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/postgresql/quoting.rb:122:in `quote'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/sanitization.rb:238:in `block in quote_bound_value'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/sanitization.rb:238:in `map!'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/sanitization.rb:238:in `quote_bound_value'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/sanitization.rb:214:in `replace_bind_variable'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/sanitization.rb:225:in `block in replace_named_bind_variables'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/sanitization.rb:219:in `gsub'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/sanitization.rb:219:in `replace_named_bind_variables'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/sanitization.rb:167:in `block in sanitize_sql_array'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:415:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_handling.rb:296:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/sanitization.rb:166:in `sanitize_sql_array'
/var/www/discourse/lib/mini_sql_multisite_connection.rb:21:in `public_send'
/var/www/discourse/lib/mini_sql_multisite_connection.rb:21:in `encode'
/var/www/discourse/lib/mini_sql_multisite_connection.rb:114:in `sql_fragment'
/var/www/discourse/lib/mini_sql_multisite_connection.rb:105: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/20250110114305_embedding_config_data_migration.rb:174:in `persist_config'
/var/www/discourse/plugins/discourse-ai/db/migrate/20250110114305_embedding_config_data_migration.rb:15:in `up'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/migration.rb:997:in `public_send'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/migration.rb:997:in `exec_migration'
/var/www/discourse/lib/freedom_patches/schema_migration_details.rb:8:in `block in exec_migration'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/benchmark-0.4.0/lib/benchmark.rb:304:in `measure'
/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.2.2.1/lib/active_record/migration.rb:978:in `block (2 levels) in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/benchmark-0.4.0/lib/benchmark.rb:304:in `measure'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/migration.rb:977:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:415:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/migration.rb:976:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/migration.rb:1190:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/migration.rb:1538:in `block in execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:616:in `block in within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-7.2.2.1/lib/active_support/concurrency/null_lock.rb:9:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/transaction.rb:613:in `within_new_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/database_statements.rb:361:in `transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/migration.rb:1589:in `ddl_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/migration.rb:1537:in `execute_migration_in_transaction'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/migration.rb:1512:in `each'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/migration.rb:1512:in `migrate_without_lock'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/migration.rb:1457:in `block in migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/migration.rb:1609:in `with_advisory_lock'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/migration.rb:1457:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/migration.rb:1264:in `up'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/migration.rb:1239:in `migrate'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/tasks/database_tasks.rb:262: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>'

Causado por:
TypeError: não é possível citar Array (TypeError)

        else raise TypeError, "can't quote #{value.class.name}"
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activerecord-7.2.2.1/lib/active_record/connection_adapters/abstract/quoting.rb:87:in `quote'

Aparando um pouco aqui

/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
(Veja o rastreamento completo executando a tarefa com --trace)
I, [2025-01-21T18:15:31.095368 #1]  INFO -- : gem install tokenizers -v 0.4.4 -i /var/www/discourse/plugins/discourse-ai/gems/3.3.6 --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.6 --no-document --ignore-dependencies --no-user-install
Successfully installed tiktoken_ruby-0.0.9-x86_64-linux
1 gem installed
gem install ed25519 -v 1.2.4 -i /var/www/discourse/plugins/discourse-ai/gems/3.3.6 --no-document --ignore-dependencies --no-user-install
Building native extensions. This could take a while...
Successfully installed ed25519-1.2.4
1 gem installed
== 20250110114305 EmbeddingConfigDataMigration: migrando =====================

I, [2025-01-21T18:15:31.095913 #1]  INFO -- : Terminating async processes
I, [2025-01-21T18:15:31.095985 #1]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main pid: 39
2025-01-21 18:15:31.096 UTC [39] LOG:  recebido pedido de desligamento rápido
I, [2025-01-21T18:15:31.096312 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 107
107:signal-handler (1737483331) Received SIGTERM scheduling shutdown...

Algo está dando errado aqui?

1 curtida

Sim, acabei de desativar o discourse-ai e a instância voltou a funcionar. Estúpido eu não ter notado aquela linha de erro antes :man_facepalming:

Você teve alguma configuração incomum no seu modelo de embeddings?

cc @roman

1 curtida

Pelo que sei… como posso confirmar? Estou usando basicamente a configuração básica.