db_migrate에서 업데이트 실패

Discourse 인스턴스를 2.9.0.beta10에서 3.2.0.beta1로 업데이트하려고 합니다.
아래와 같은 오류가 발생합니다.

Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I, [2023-09-15T02:32:08.512373 #1]  INFO -- : Compiled js-processor: tmp/js-processor.js
== 20230118020114 AddPublicTopicCountToTags: migrating ========================
-- add_column(:tags, :public_topic_count, :integer, {:default=>0, :null=>false})
   -> 0.0021s
-- execute("UPDATE tags t\nSET public_topic_count = x.topic_count\nFROM (\n  SELECT\n    COUNT(topics.id) AS topic_count,\n    tags.id AS tag_id\n  FROM tags\n  INNER JOIN topic_tags ON tags.id = topic_tags.tag_id\n  INNER JOIN topics ON topics.id = topic_tags.topic_id AND topics.deleted_at IS NULL AND topics.archetype != 'private_message'\n  INNER JOIN categories ON categories.id = topics.category_id AND NOT categories.read_restricted\n  GROUP BY tags.id\n) x\nWHERE x.tag_id = t.id\nAND x.topic_count <> t.public_topic_count;\n")

I, [2023-09-15T02:32:08.512848 #1]  INFO -- : Terminating async processes
I, [2023-09-15T02:32:08.512929 #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: 42
I, [2023-09-15T02:32:08.513001 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 111
111:signal-handler (2023-09-15 02:32:08.513 UTC [42] LOG:  received fast shutdown request
1694745128) Received SIGTERM scheduling shutdown...
2023-09-15 02:32:08.522 UTC [42] LOG:  aborting any active transactions
2023-09-15 02:32:08.524 UTC [42] LOG:  background worker "logical replication launcher" (PID 51) exited with exit code 1
2023-09-15 02:32:08.526 UTC [46] LOG:  shutting down
111:M 15 Sep 2023 02:32:08.532 # User requested shutdown...
111:M 15 Sep 2023 02:32:08.532 * Saving the final RDB snapshot before exiting.
2023-09-15 02:32:08.768 UTC [42] LOG:  database system is shut down
111:M 15 Sep 2023 02:32:11.475 * DB saved on disk
111:M 15 Sep 2023 02:32:11.475 # Redis is now ready to exit, bye bye...


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 787 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}

무엇이 문제인지 아는 분이 있을까요?
이전에 오류 없이 인스턴스를 업데이트한 적이 있습니다.
Discourse doctor를 실행해도 검색할 단서를 찾지 못했습니다.


위의 메시지는 이 SQL 문장을 가리키는 것일까요?

UPDATE tags t
SET public_topic_count = x.topic_count
FROM (
	SELECT    COUNT(topics.id) AS topic_count,    
	tags.id AS tag_id
	FROM tags
	INNER JOIN topic_tags ON tags.id = topic_tags.tag_id
	INNER JOIN topics ON topics.id = topic_tags.topic_id AND topics.deleted_at IS NULL AND topics.archetype != 'private_message'
	INNER JOIN categories ON categories.id = topics.category_id AND NOT categories.read_restricted
	GROUP BY tags.id
) x
	WHERE x.tag_id = t.id
	AND x.topic_count <> t.public_topic_count;

왜냐하면 DB에서 직접 select 부분의 코드만 실행하면 오류가 나지 않기 때문입니다.
add_column(:tags, :public_topic_count, :integer, {:default=>0, :null=>false})을 통해 db:migrate 작업이 먼저 컬럼을 추가하는 것을 확인했습니다.
그런데 왜 위의 쿼리에서 실패하는지 모르겠습니다.

로그 하단에 "위로 스크롤하여 이전 오류 메시지를 찾아보세요"라는 메시지가 있나요? 그렇다면 다른 오류 메시지를 발견했나요?

팁 감사합니다. 그 전에 오류가 있었습니다. 정말로 자정 이후에 서버를 업데이트하는 것을 멈춰야 합니다. 그 시간에 제 리소스가 부족하기 때문입니다.


그럼에도 불구하고, 앞으로 읽는 분들을 위해:
오류는 테이블의 tags에 동일한 이름 열 값이 여러 행에 존재하기 때문에 발생했습니다.
중복된 행이 있는 태그를 삭제한 후 업그레이드가 순조롭게 진행되었습니다.