Katello - sync incomplete - duplicate key

Hi,

I’m using katello 3.17 (fresh install) and I can’t synchronize rhel-7-server-rpms. The synchronization stops with message “Sync incomplete” and the following exception:

“duplicate key value violates unique constraint “core_repositoryversion_repository_id_number_3c54ce50_uniq”\n” +
“DETAIL: Key (repository_id, number)=(50ad5057-68a1-4067-a0cd-50855cd0f1e9, 2) already exists.\n”},

It was working before. No other repos were added. It suddenly stopped synchronizing. Is there a way to fix it (e.g. cleanup database) or is it a bug?

Regards,
Toni

Katello 3.18RC1 includes this patch which partially fixes the issue:

The error still occurs but the repo successfully synchronized upon retry.

I believe I ran into the same error and posted comment here:

However, after manually apply the fix, and then trying publish a content view Version, im seeing a “Pulp 503” error which does not allow the Version to be published. Did you run into any errors after applying fix? Or did it work smoothly for you?

I have also tried to apply the patch manually. It did not work (can’t remember the error code). There are only few hosts registered to katello so it was easy to just install v3.18 from scratch.