Migrate from GitLab to Gitea fail "duplicate key value violates unique constraint "UQE_issue_repo_index"" #13856

Open
opened 2025-11-02 10:55:14 -06:00 by GiteaMirror · 7 comments
Owner

Originally created by @kittkott on GitHub (Dec 19, 2024).

Description

Try to migrate from old GitLab Community Edition 11.4.5 to new Gitea installation.
Old Repo have zero Issues. I have check a box: Labels, Merge Request, Releases.

2024/12/18 17:55:14 ...ices/task/migrate.go:60:func1() [E] runMigrateTask[14] by DoerID[3] to RepoID[24] for OwnerID[12] failed: pq: duplicate key value violates unique constraint "UQE_issue_repo_index"
2024/12/18 17:55:14 ...ervices/task/task.go:53:handler() [E] Run task failed: pq: duplicate key value violates unique constraint "UQE_issue_repo_index"

Gitea Version

1.22.6

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.34.1

Operating System

Ubuntu 22.04.5 LTS

How are you running Gitea?

get from https://dl.gitea.com/gitea/1.22.6/gitea-1.22.6-linux-amd64
Systemd service from https://github.com/go-gitea/gitea/blob/release/v1.22/contrib/systemd/gitea.service

Database

PostgreSQL

Originally created by @kittkott on GitHub (Dec 19, 2024). ### Description Try to migrate from old GitLab Community Edition 11.4.5 to new Gitea installation. Old Repo have zero Issues. I have check a box: Labels, Merge Request, Releases. 2024/12/18 17:55:14 ...ices/task/migrate.go:60:func1() [E] runMigrateTask[14] by DoerID[3] to RepoID[24] for OwnerID[12] failed: pq: duplicate key value violates unique constraint "UQE_issue_repo_index" 2024/12/18 17:55:14 ...ervices/task/task.go:53:handler() [E] Run task failed: pq: duplicate key value violates unique constraint "UQE_issue_repo_index" ### Gitea Version 1.22.6 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version 2.34.1 ### Operating System Ubuntu 22.04.5 LTS ### How are you running Gitea? get from https://dl.gitea.com/gitea/1.22.6/gitea-1.22.6-linux-amd64 Systemd service from https://github.com/go-gitea/gitea/blob/release/v1.22/contrib/systemd/gitea.service ### Database PostgreSQL
GiteaMirror added the topic/repo-migrationtype/bug labels 2025-11-02 10:55:14 -06:00
Author
Owner

@lunny commented on GitHub (Dec 19, 2024):

I think this is an known issue.

@lunny commented on GitHub (Dec 19, 2024): I think this is an known issue.
Author
Owner

@kittkott commented on GitHub (Dec 20, 2024):

Some problems may be similar to "GitLab migrate merge requests + issues faile #13884". But I have zero "issues" in the GitLab repo.

@kittkott commented on GitHub (Dec 20, 2024): Some problems may be similar to "GitLab migrate merge requests + issues faile #13884". But I have zero "issues" in the GitLab repo.
Author
Owner

@yp05327 commented on GitHub (Dec 26, 2024):

If there's a sample GitLab instance which can reproduce this issue....I have tried to deploy a GitLab with version 11.4.5, and created an empty repo with zero issues, and the migration is done. Maybe I need to use PostgreSQL instead of SQLite.
PostgreSQL also works.

@yp05327 commented on GitHub (Dec 26, 2024): If there's a sample GitLab instance which can reproduce this issue....I have tried to deploy a GitLab with version 11.4.5, and created an empty repo with zero issues, and the migration is done. ~~Maybe I need to use PostgreSQL instead of SQLite.~~ PostgreSQL also works.
Author
Owner

@kittkott commented on GitHub (Dec 28, 2024):

May be version of PostgreSQL 16.6 may work incorrect?
I remove problem Merge Request, but problem still exist.
I cant public my gitlab instance.

From postgres log.
New error:
2024-12-28 10:45:00.614 MSK [456287] gitea@giteadb ERROR: duplicate key value violates unique constraint "UQE_issue_repo_index"
2024-12-28 10:45:00.614 MSK [456287] gitea@giteadb DETAIL: Key (repo_id, index)=(26, 1228) already exists.
2024-12-28 10:45:00.614 MSK [456287] gitea@giteadb STATEMENT: INSERT INTO "issue" ("repo_id","index","poster_id","original_author","original_author_id","name","content","milestone_id","priority","is_closed","is_pull","num_comments","ref","pin_order","deadline_unix","created_unix","updated_unix","closed_unix","is_locked") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19) RETURNING "id"

Errors before last try:
2024-12-18 11:46:06.984 MSK [300384] gitea@giteadb ERROR: duplicate key value violates unique constraint "UQE_issue_repo_index"
2024-12-18 11:46:06.984 MSK [300384] gitea@giteadb DETAIL: Key (repo_id, index)=(17, 1217) already exists.
2024-12-18 11:46:06.984 MSK [300384] gitea@giteadb STATEMENT: INSERT INTO "issue" ("repo_id","index","poster_id","original_author","original_author_id","name","content","milestone_id","priority","is_closed","is_pull","num_comments","ref","pin_order","deadline_unix","created_unix","updated_unix","closed_unix","is_locked") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19) RETURNING "id"

@kittkott commented on GitHub (Dec 28, 2024): May be version of PostgreSQL 16.6 may work incorrect? I remove problem Merge Request, but problem still exist. I cant public my gitlab instance. From postgres log. New error: 2024-12-28 10:45:00.614 MSK [456287] gitea@giteadb ERROR: duplicate key value violates unique constraint "UQE_issue_repo_index" 2024-12-28 10:45:00.614 MSK [456287] gitea@giteadb DETAIL: Key (repo_id, index)=(26, 1228) already exists. 2024-12-28 10:45:00.614 MSK [456287] gitea@giteadb STATEMENT: INSERT INTO "issue" ("repo_id","index","poster_id","original_author","original_author_id","name","content","milestone_id","priority","is_closed","is_pull","num_comments","ref","pin_order","deadline_unix","created_unix","updated_unix","closed_unix","is_locked") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19) RETURNING "id" Errors before last try: 2024-12-18 11:46:06.984 MSK [300384] gitea@giteadb ERROR: duplicate key value violates unique constraint "UQE_issue_repo_index" 2024-12-18 11:46:06.984 MSK [300384] gitea@giteadb DETAIL: Key (repo_id, index)=(17, 1217) already exists. 2024-12-18 11:46:06.984 MSK [300384] gitea@giteadb STATEMENT: INSERT INTO "issue" ("repo_id","index","poster_id","original_author","original_author_id","name","content","milestone_id","priority","is_closed","is_pull","num_comments","ref","pin_order","deadline_unix","created_unix","updated_unix","closed_unix","is_locked") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19) RETURNING "id"
Author
Owner

@kittkott commented on GitHub (Dec 28, 2024):

2024/12/28 10:45:00 ...ices/task/migrate.go:60:func1() [E] runMigrateTask[16] by DoerID[3] to RepoID[26] for OwnerID[12] failed: pq: duplicate key value violates unique constraint "UQE_issue_repo_index"
2024/12/28 10:45:00 ...ervices/task/task.go:53:handler() [E] Run task failed: pq: duplicate key value violates unique constraint "UQE_issue_repo_index"

@kittkott commented on GitHub (Dec 28, 2024): 2024/12/28 10:45:00 ...ices/task/migrate.go:60:func1() [E] runMigrateTask[16] by DoerID[3] to RepoID[26] for OwnerID[12] failed: pq: duplicate key value violates unique constraint "UQE_issue_repo_index" 2024/12/28 10:45:00 ...ervices/task/task.go:53:handler() [E] Run task failed: pq: duplicate key value violates unique constraint "UQE_issue_repo_index"
Author
Owner

@kittkott commented on GitHub (Dec 28, 2024):

Some observations: Problem always exist with last Merge Request (by index).

@kittkott commented on GitHub (Dec 28, 2024): Some observations: Problem always exist with last Merge Request (by index).
Author
Owner

@lunny commented on GitHub (Dec 29, 2024):

May be version of PostgreSQL 16.6 may work incorrect? I remove problem Merge Request, but problem still exist. I cant public my gitlab instance.

From postgres log. New error: 2024-12-28 10:45:00.614 MSK [456287] gitea@giteadb ERROR: duplicate key value violates unique constraint "UQE_issue_repo_index" 2024-12-28 10:45:00.614 MSK [456287] gitea@giteadb DETAIL: Key (repo_id, index)=(26, 1228) already exists. 2024-12-28 10:45:00.614 MSK [456287] gitea@giteadb STATEMENT: INSERT INTO "issue" ("repo_id","index","poster_id","original_author","original_author_id","name","content","milestone_id","priority","is_closed","is_pull","num_comments","ref","pin_order","deadline_unix","created_unix","updated_unix","closed_unix","is_locked") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19) RETURNING "id"

Errors before last try: 2024-12-18 11:46:06.984 MSK [300384] gitea@giteadb ERROR: duplicate key value violates unique constraint "UQE_issue_repo_index" 2024-12-18 11:46:06.984 MSK [300384] gitea@giteadb DETAIL: Key (repo_id, index)=(17, 1217) already exists. 2024-12-18 11:46:06.984 MSK [300384] gitea@giteadb STATEMENT: INSERT INTO "issue" ("repo_id","index","poster_id","original_author","original_author_id","name","content","milestone_id","priority","is_closed","is_pull","num_comments","ref","pin_order","deadline_unix","created_unix","updated_unix","closed_unix","is_locked") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19) RETURNING "id"

If you can send a dm to me, I can help with some investigation.

@lunny commented on GitHub (Dec 29, 2024): > May be version of PostgreSQL 16.6 may work incorrect? I remove problem Merge Request, but problem still exist. I cant public my gitlab instance. > > From postgres log. New error: 2024-12-28 10:45:00.614 MSK [456287] gitea@giteadb ERROR: duplicate key value violates unique constraint "UQE_issue_repo_index" 2024-12-28 10:45:00.614 MSK [456287] gitea@giteadb DETAIL: Key (repo_id, index)=(26, 1228) already exists. 2024-12-28 10:45:00.614 MSK [456287] gitea@giteadb STATEMENT: INSERT INTO "issue" ("repo_id","index","poster_id","original_author","original_author_id","name","content","milestone_id","priority","is_closed","is_pull","num_comments","ref","pin_order","deadline_unix","created_unix","updated_unix","closed_unix","is_locked") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19) RETURNING "id" > > Errors before last try: 2024-12-18 11:46:06.984 MSK [300384] gitea@giteadb ERROR: duplicate key value violates unique constraint "UQE_issue_repo_index" 2024-12-18 11:46:06.984 MSK [300384] gitea@giteadb DETAIL: Key (repo_id, index)=(17, 1217) already exists. 2024-12-18 11:46:06.984 MSK [300384] gitea@giteadb STATEMENT: INSERT INTO "issue" ("repo_id","index","poster_id","original_author","original_author_id","name","content","milestone_id","priority","is_closed","is_pull","num_comments","ref","pin_order","deadline_unix","created_unix","updated_unix","closed_unix","is_locked") VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19) RETURNING "id" If you can send a dm to me, I can help with some investigation.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#13856