# Could not upload a new collection version to Ansible Galaxy

**URL:** <https://forum.ansible.com/t/could-not-upload-a-new-collection-version-to-ansible-galaxy/1816>\
**Category:** Get Help\
**Tags:** collections, galaxy-ng\
**Created:** [October 19, 2023, 6:01pm UTC](https://forum.ansible.com/t/could-not-upload-a-new-collection-version-to-ansible-galaxy/1816 "2023-10-19T18:01:28Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![Torie-Coding](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/torie-coding/32/1248_2.png) [@Torie-Coding](https://forum.ansible.com/u/Torie-Coding)\
**Post date:** [October 19, 2023, 6:01pm UTC](https://forum.ansible.com/t/could-not-upload-a-new-collection-version-to-ansible-galaxy/1816/1 "2023-10-19T18:01:28Z")

</div>

Hey there,

i have tried to upload a new version of my Ansible Collection but iam getting the following error message:

```auto
Status: 
Failed
Approval status: waiting for import to finish
Version: 1.1.0
Error message:
duplicate key value violates unique constraint "unique_is_highest"
DETAIL: Key (collection_id, is_highest)=(018ae852-5831-78a0-b19f-d2d6a4e41174, t) already exists.
  File "/venv/lib64/python3.11/site-packages/pulpcore/tasking/tasks.py", line 66, in _execute_task
    result = func(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/app/galaxy_ng/app/tasks/publishing.py", line 115, in import_and_auto_approve
    repo = _upload_collection(**kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/galaxy_ng/app/tasks/publishing.py", line 65, in _upload_collection
    general_create(*general_args, **kwargs)
  File "/venv/lib64/python3.11/site-packages/pulpcore/app/tasks/base.py", line 38, in general_create
    instance = serializer.save()
               ^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/rest_framework/serializers.py", line 212, in save
    self.instance = self.create(validated_data)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/pulp_ansible/app/serializers.py", line 530, in create
    finish_collection_upload(content, tags=tags, origin_repository=origin_repository)
  File "/venv/lib64/python3.11/site-packages/pulp_ansible/app/tasks/upload.py", line 84, in finish_collection_upload
    _update_highest_version(collection_version)
  File "/venv/lib64/python3.11/site-packages/pulp_ansible/app/tasks/collections.py", line 439, in _update_highest_version
    update_qs.update(is_highest=F("new_is_highest"))
  File "/venv/lib64/python3.11/site-packages/django/db/models/query.py", line 1206, in update
    rows = query.get_compiler(self.db).execute_sql(CURSOR)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/django/db/models/sql/compiler.py", line 1984, in execute_sql
    cursor = super().execute_sql(result_type)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/django/db/models/sql/compiler.py", line 1562, in execute_sql
    cursor.execute(sql, params)
  File "/venv/lib64/python3.11/site-packages/django/db/backends/utils.py", line 67, in execute
    return self._execute_with_wrappers(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/django/db/backends/utils.py", line 80, in _execute_with_wrappers
    return executor(sql, params, many, context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/django/db/backends/utils.py", line 84, in _execute
    with self.db.wrap_database_errors:
  File "/venv/lib64/python3.11/site-packages/django/db/utils.py", line 91, in __exit__
    raise dj_exc_value.with_traceback(traceback) from exc_value
  File "/venv/lib64/python3.11/site-packages/django/db/backends/utils.py", line 89, in _execute
    return self.cursor.execute(sql, params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/venv/lib64/python3.11/site-packages/psycopg/cursor.py", line 723, in execute
    raise ex.with_traceback(None)

```

But the Log shows:  
Importing with galaxy-importer 0.4.14  
Getting doc strings via ansible-doc  
Finding content inside collection  
Loading module entry  
Loading module group  
**Collection loading complete**

Failed

I dont understand the error. It seems that it doesn’t have anything todo with my code. I have created the collection with `ansible-galaxy collection build` and tried to upload it via webinterface. When i try to upload this file again it says

> ERROR! Error when publishing collection to cmd\_arg ([https://galaxy.ansible.com/api/](https://galaxy.ansible.com/api/)) (HTTP Code: 400, Message: Collection torie\_coding.keepass-1.1.0 already exists Code: invalid)

Thank you for your help.

---

<div class="post-metadata">

**Author:** ![fitbeard](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/fitbeard/32/1208_2.png) [@fitbeard](https://forum.ansible.com/u/fitbeard)\
**Post date:** [October 19, 2023, 6:08pm UTC](https://forum.ansible.com/t/could-not-upload-a-new-collection-version-to-ansible-galaxy/1816/2 "2023-10-19T18:08:35Z")

</div>

Hello,

I have same situation:

```auto
ERROR! Galaxy import process failed: duplicate key value violates unique constraint "unique_is_highest"
DETAIL: Key (collection_id, is_highest)=(e201c1cf-1413-4f3b-9e57-2bac1ef184e5, t) already exists. (Code: UNKNOWN)

```

Also found this issue in Red Hat’s KB: [On Red Hat Automation Hub, Sync of collection fails with error "duplicate key value violates unique constraint \"unique\_is\_highest\"\" - Red Hat Customer Portal](https://access.redhat.com/solutions/7033171)

---

<div class="post-metadata">

**Author:** ![Torie-Coding](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/torie-coding/32/1248_2.png) [@Torie-Coding](https://forum.ansible.com/u/Torie-Coding)\
**Post date:** [October 19, 2023, 6:16pm UTC](https://forum.ansible.com/t/could-not-upload-a-new-collection-version-to-ansible-galaxy/1816/3 "2023-10-19T18:16:08Z")

</div>

So seems like there is no existing solution yet.  
Thank you for your reply i i didn‘t find this article.

---

<div class="post-metadata">

**Author:** ![ccamacho](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ccamacho/32/1269_2.png) [@ccamacho](https://forum.ansible.com/u/ccamacho)\
**Post date:** [October 20, 2023, 12:15pm UTC](https://forum.ansible.com/t/could-not-upload-a-new-collection-version-to-ansible-galaxy/1816/4 "2023-10-20T12:15:29Z")

</div>

> [@Torie-Coding](#):
>
> ere is no existing solution yet.  
> Thank you for your reply i i didn‘t find this article.

Same problem here. Any help on this? It looks like a global problem affecting Galaxy. No solution so far.

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [October 20, 2023, 7:29pm UTC](https://forum.ansible.com/t/could-not-upload-a-new-collection-version-to-ansible-galaxy/1816/5 "2023-10-20T19:29:46Z")

</div>

We believe this will be addressed by [Fix update\_highest\_version when versions were uploaded out-of-order by gerrod3 · Pull Request #1624 · pulp/pulp\_ansible · GitHub](https://github.com/pulp/pulp_ansible/pull/1624)

---

<div class="post-metadata">

**Author:** ![jholland](https://avatars.discourse-cdn.com/v4/letter/j/f14d63/32.png) [@jholland](https://forum.ansible.com/u/jholland)\
**Post date:** [October 23, 2023, 9:45am UTC](https://forum.ansible.com/t/could-not-upload-a-new-collection-version-to-ansible-galaxy/1816/6 "2023-10-23T09:45:38Z")

</div>

Hit this issue too. Looking forward to the fix being deployed. Thank you

---

<div class="post-metadata">

**Author:** ![Torie-Coding](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/torie-coding/32/1248_2.png) [@Torie-Coding](https://forum.ansible.com/u/Torie-Coding)\
**Post date:** [October 24, 2023, 8:12am UTC](https://forum.ansible.com/t/could-not-upload-a-new-collection-version-to-ansible-galaxy/1816/7 "2023-10-24T08:12:50Z")

</div>

A few hours ago the [Fix update\_highest\_version when versions were uploaded out-of-order (… · pulp/pulp\_ansible@55f02c6 · GitHub](https://github.com/pulp/pulp_ansible/commit/55f02c6238176c47f31de7742b5b9264fa4ef73a) was pushed into Master. So i belive that the Fix live now ? I tried to upload a new version again but i get the same error.

---

<div class="post-metadata">

**Author:** ![jholland](https://avatars.discourse-cdn.com/v4/letter/j/f14d63/32.png) [@jholland](https://forum.ansible.com/u/jholland)\
**Post date:** [October 24, 2023, 8:50am UTC](https://forum.ansible.com/t/could-not-upload-a-new-collection-version-to-ansible-galaxy/1816/8 "2023-10-24T08:50:01Z")

</div>

Same as @Torie-Coding, still unable to upload a new version

---

<div class="post-metadata">

**Author:** ![dineshsuthar786](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dineshsuthar786/32/1305_2.png) [@dineshsuthar786](https://forum.ansible.com/u/dineshsuthar786)\
**Post date:** [October 24, 2023, 10:41am UTC](https://forum.ansible.com/t/could-not-upload-a-new-collection-version-to-ansible-galaxy/1816/9 "2023-10-24T10:41:07Z")

</div>

Also, If we retry to push the same collection version, we are getting error as “Artifact already exists” but there is no new collection version uploaded. To whom we can contact in galaxy team to delete this artifact, which was failed to upload and we can retry to push the same collection version.

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [October 24, 2023, 12:37pm UTC](https://forum.ansible.com/t/could-not-upload-a-new-collection-version-to-ansible-galaxy/1816/10 "2023-10-24T12:37:59Z")

</div>

Hi folks, we’re still in the process of getting the patch out to production. Here’s a list things we typically have to do to get a patch deployed:

1. get the pulp\_ansible PR merged [Fix update\_highest\_version when versions were uploaded out-of-order by gerrod3 · Pull Request #1624 · pulp/pulp\_ansible · GitHub](https://github.com/pulp/pulp_ansible/pull/1624)
2. make a backport for pulp\_ansible [[PR #1624/55f02c62 backport][0.20] Fix update\_highest\_version when versions were uploaded out-of-order by patchback[bot] · Pull Request #1625 · pulp/pulp\_ansible · GitHub](https://github.com/pulp/pulp_ansible/pull/1625)
3. bump the pulp\_ansible version in galaxy\_ng [update pulp\_ansible to 0.20.2 by jctanner · Pull Request #1950 · ansible/galaxy\_ng · GitHub](https://github.com/ansible/galaxy_ng/pull/1950)
4. wait for the CI/CD setup to deploy galaxy\_ng’s master branch to [galaxy-dev.ansible.com](http://galaxy-dev.ansible.com)
5. do QA/QE on dev
6. trigger a deploy to [galaxy-stage.ansible.com](http://galaxy-stage.ansible.com) and do QA/QE there again
7. trigger a deploy to [galaxy.ansible.com](http://galaxy.ansible.com)

We’re on step 4 right now and will get through the rest as quick as we can.

UPDATE: the fix is in production now

---

<div class="post-metadata">

**Author:** ![Torie-Coding](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/torie-coding/32/1248_2.png) [@Torie-Coding](https://forum.ansible.com/u/Torie-Coding)\
**Post date:** [October 24, 2023, 4:15pm UTC](https://forum.ansible.com/t/could-not-upload-a-new-collection-version-to-ansible-galaxy/1816/11 "2023-10-24T16:15:26Z")

</div>

Thanks for the detailed process. Do you know what we can do regarding the error “Artifact already exists” when the fix is deployed ?

---

<div class="post-metadata">

**Author:** ![dineshsuthar786](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dineshsuthar786/32/1305_2.png) [@dineshsuthar786](https://forum.ansible.com/u/dineshsuthar786)\
**Post date:** [October 25, 2023, 3:22am UTC](https://forum.ansible.com/t/could-not-upload-a-new-collection-version-to-ansible-galaxy/1816/12 "2023-10-25T03:22:49Z")

</div>

@tannerjc Thanks for the fix, I am able to deploy the latest collection to galaxy and did not face any issue.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [November 24, 2023, 3:23am UTC](https://forum.ansible.com/t/could-not-upload-a-new-collection-version-to-ansible-galaxy/1816/13 "2023-11-24T03:23:43Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
