[go: up one dir, main page]

Skip to content

ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_issues_on_project_id_and_iid

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

It appears that http://gitlab.com/gitlab-org/gitlab/blob/b228b1568657c2a5d5724e6c7eca899bd47193e2/lib/gitlab/import_export/importer.rb#L21-21 restore is somehow finding duplicates and triggers the following error:

ActiveRecord::RecordNotUnique: PG::UniqueViolation: ERROR: duplicate key value violates unique constraint "index_issues_on_project_id_and_iid"DETAIL: Key (project_id, iid)=([PROJECT_ID], [IID]) already exists.

Recommendation - there has to be some reason/way to prevent, but for now, perhaps do a unique check before importing on this line - http://gitlab.com/gitlab-org/gitlab/blob/b228b1568657c2a5d5724e6c7eca899bd47193e2/lib/gitlab/import_export/relation_tree_restorer.rb#L83-83

Edit on 2022-03-11: lib/gitlab/import_export/group/relation_tree_restorer.rb seems to be the newer path of that same line.

Edited by 🤖 GitLab Bot 🤖