Index error while restoring

Hello,

We host a production instance of Gitlab Community Edition 16.1.1 on an AWS EC2 via a docker container.
The database is postgresql 13.8 (AWS RDS).
We perform daily backups on this instance via gitlab-backup create command.

Today, we need to restore one of these production backups on an other instance which is a clone of our production: same hosting, same version of gitlab, same version of db etc…

We launch this restore via :
docker exec gitlab gitlab-backup restore BACKUP=1694149230_2023_09_08_16.1.1 force=yes
It fails with the following message:

NoMethodError: undefined method `chomp' for nil:NilClass
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/task_helpers.rb:64:in `prompt'
/opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/task_helpers.rb:29:in `ask_to_continue'
/opt/gitlab/embedded/service/gitlab-rails/lib/backup/manager.rb:112:in `run_restore_task'
/opt/gitlab/embedded/service/gitlab-rails/lib/backup/manager.rb:244:in `block in run_all_restore_tasks'
/opt/gitlab/embedded/service/gitlab-rails/lib/backup/manager.rb:242:in `each_key'
/opt/gitlab/embedded/service/gitlab-rails/lib/backup/manager.rb:242:in `run_all_restore_tasks'
/opt/gitlab/embedded/service/gitlab-rails/lib/backup/manager.rb:80:in `restore'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:21:in `block in restore_backup'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:62:in `lock_backup'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:18:in `restore_backup'
/opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/backup.rake:107:in `block (3 levels) in <top (required)>'
/opt/gitlab/embedded/bin/bundle:25:in `load'
/opt/gitlab/embedded/bin/bundle:25:in `<main>'
Tasks: TOP => gitlab:backup:restore
(See full trace by running task with --trace)
------ BEGIN ERRORS -----
ERROR:  could not create unique index "index_merge_request_diff_commit_users_on_name_and_email"
DETAIL:  Key (name, email)=(XXXXXXXXXXXXX, XXXXX@XXXXX.com) is duplicated.
------ END ERRORS -------
[DONE]
Source backup for the database ci doesn't exist. Skipping the task
2023-09-07 12:40:32 UTC -- Restoring database ... done
2023-09-07 12:40:32 UTC -- There were errors in restoring the schema. This may cause
issues if this results in missing indexes, constraints, or
columns. Please record the errors above and contact GitLab
Support if you have questions:
https://about.gitlab.com/support/

(Personnal data hidden by X)

One notable information is that the name in the problematic key is written with a specific font (Cannot show it as it is personnal data)

How to solve this error ?

Thanks

I encountered this exactly same error with a restore for 16.3.1.

Any ideas how to fix it or if it matters at all?

This is on-prem running on Debian 11 within vSphere.

I got exactly the same error on-pre kubernetes gitlab with this command:

kubectl -n gitlab exec – backup-utility --restore -t

And the error was fixed with this command:

kubectl -n gitlab exec -it – backup-utility --restore -t

You need to add “-it” option for kubectl exec command since “backup-utility --restore” command requires yes/no prompt.