Rpm_publication gives: failed: ''File already exists''

Problem:

Running rpm_publication gives this error on one of the 33 repositories.

File already exists

The error is hard.

How can this be remedied please?
Thank you.

A repair and reclaim were done on the repository.

Expected outcome:

Please help to fix this.

Pulpcore version:

      "versions": {
        "deb": "3.4.0",
        "rpm": "3.27.2",
        "core": "3.68.1",
        "file": "3.68.1",
        "maven": "0.8.1",
        "ostree": "2.4.4",
        "python": "3.12.5",
        "ansible": "0.23.1",
        "certguard": "3.68.1",
        "container": "2.22.0"
      }
      
      pulp.squeezer 0.1.0

Pulp plugins installed and their versions:

Operating system - distribution and version:

SLES15 SP5

Other relevant data:

   failed: [localhost] (item={'name': 'upstream-SUSE-PackageHub-15-SP6-Backports-Pool', 'backend': 'http://smt.abcgroup.net/repo/SUSE/Backports/SLE-15-SP6_x86_64/standard/', 'base': 'SUSE/Backports/SLE-15-SP6_x86_64/standard'}) => changed=false 
  ansible_index_var: p_idx
  ansible_loop_var: item
  item:
    backend: http://smt.abcgroup.net/repo/SUSE/Backports/SLE-15-SP6_x86_64/standard/
    base: SUSE/Backports/SLE-15-SP6_x86_64/standard
    name: upstream-SUSE-PackageHub-15-SP6-Backports-Pool
  msg: 'Task /pulp/api/v3/tasks/01961eb6-5398-79d1-8251-74ad7d3818f5/ failed: ''File already exists'''
  p_idx: 32


itad237:/tmp # pulp task show --uuid 01961eb6-5398-79d1-8251-74ad7d3818f5
{
  "pulp_href": "/pulp/api/v3/tasks/01961eb6-5398-79d1-8251-74ad7d3818f5/",
  "prn": "prn:core.task:01961eb6-5398-79d1-8251-74ad7d3818f5",
  "pulp_created": "2025-04-10T07:59:47.609969Z",
  "pulp_last_updated": "2025-04-10T07:59:47.609986Z",
  "state": "failed",
  "name": "pulp_rpm.app.tasks.publishing.publish",
  "logging_cid": "069882cf24a343a0b0237cd3df016127",
  "created_by": "/pulp/api/v3/users/1/",
  "unblocked_at": "2025-04-10T07:59:47.652888Z",
  "started_at": "2025-04-10T07:59:47.785488Z",
  "finished_at": "2025-04-10T08:01:27.738477Z",
  "error": {
    "traceback": "  File \"/usr/local/lib/python3.9/site-packages/pulpcore/tasking/tasks.py\", line 68, in _execute_task\n    result = func(*args, **kwargs)\n  File \"/usr/local/lib/python3.9/site-packages/pulp_rpm/app/tasks/publishing.py\", line 385, in publish\n    generate_repo_metadata(\n  File \"/usr/local/lib/python3.9/site-packages/pulp_rpm/app/tasks/publishing.py\", line 584, in generate_repo_metadata\n    upd_xml = cr.UpdateInfoXmlFile(upd_xml_path, compressiontype=cr_compression_type)\n  File \"/usr/local/lib64/python3.9/site-packages/createrepo_c/__init__.py\", line 306, in __init__\n    XmlFile.__init__(self, path, XMLFILE_UPDATEINFO,\n",
    "description": "File already exists"
  },
  "worker": "/pulp/api/v3/workers/0195d174-e433-7dbc-ace1-d77302ded159/",
  "parent_task": null,
  "child_tasks": [],
  "task_group": null,
  "progress_reports": [
    {
      "message": "Generating repository metadata",
      "code": "publish.generating_metadata",
      "state": "failed",
      "total": 1,
      "done": 0,
      "suffix": null
    }
  ],
  "created_resources": [],
  "reserved_resources_record": [
    "shared:prn:rpm.rpmrepository:019519b8-4db2-7102-a6e6-4a5f5c1ea5b3",
    "shared:prn:core.domain:019513aa-8ee7-77d4-af49-eb445030ae0b"
  ]
}

We have also observed this issue for at least one SLES repo.
The sync is successful, but the publish fails with the error.
Unfortunately, the repo requires SLES login credentials, i.e. it is not a publicly available reproducer, I can however post our remote with the credentials REDACTED:

{
  "pulp_href": "/pulp/api/v3/remotes/rpm/rpm/01963370-4016-7a3f-91b1-21c3f6fc0f0a/",
  "pulp_created": "2025-04-14T08:35:16.632331Z",
  "pulp_last_updated": "2025-04-14T11:29:16.210018Z",
  "name": "2687_SUSE-PackageHub-15-SP6-Backports-Pool_for_sle-15-x86_64-16961352",
  "url": "https://updates.suse.com/SUSE/Backports/SLE-15-SP6_x86_64/standard/",
  "ca_cert": null,
  "client_cert": null,
  "tls_validation": true,
  "proxy_url": "",
  "pulp_labels": {},
  "download_concurrency": null,
  "max_retries": null,
  "policy": "immediate",
  "total_timeout": 3600.0,
  "connect_timeout": 60.0,
  "sock_connect_timeout": 60.0,
  "sock_read_timeout": 3600.0,
  "headers": null,
  "rate_limit": 0,
  "hidden_fields": [
    {
      "name": "client_key",
      "is_set": false
    },
    {
      "name": "proxy_username",
      "is_set": false
    },
    {
      "name": "proxy_password",
      "is_set": false
    },
    {
      "name": "username",
      "is_set": false
    },
    {
      "name": "password",
      "is_set": false
    }
  ],
  "sles_auth_token": "REDACTED"
}

Hi quba42

Thanks for the post, sorry for the long delay.

We have local/copy access to the SLES repo.
Am I correct in what you say, that the duplicate is in the source repo?
Even if I delete my repos and rebuild it still fails.

Jan

The following thread on theforeman forum lists a lot more information on this exact error (albeit within the Katello context): Katello throws "File already exists" on publication - #11 by ochnerd - Support - TheForeman

One way to work around the issue is to use sync_policy = "mirror_complete" that way you will get an exact copy of the upstream repo (complete with warts and everything else this implies), but you won’t get an error.

Alternatively, given you say you already have a local mirror of the repo that you can manipulate, look for duplicate entries of <data type="updateinfo"> in your local repomd.xml and remove the duplicate block. You should now be able to sync as usual without the error.

1 Like

Many thanks for this info.

That settles it, appreciated.

1 Like

How wrong can one be…

The error now is(a month later), without changing sync-policy but after a delete and rebuild.

"RepositoryVersion matching query does not exist."

{
  "pulp_href": "/pulp/api/v3/tasks/01971159-733f-71d6-b6a2-5bc252c87368/",
  "prn": "prn:core.task:01971159-733f-71d6-b6a2-5bc252c87368",
  "pulp_created": "2025-05-27T10:46:04.352366Z",
  "pulp_last_updated": "2025-05-27T10:46:04.352382Z",
  "state": "failed",
  "name": "pulp_rpm.app.tasks.publishing.publish",
  "logging_cid": "d0887d1e0e844d13a3fecb5b8736ab7e",
  "created_by": "/pulp/api/v3/users/1/",
  "unblocked_at": "2025-05-27T10:56:51.891245Z",
  "started_at": "2025-05-27T10:56:51.957107Z",
  "finished_at": "2025-05-27T10:56:51.964132Z",
  "error": {
    "traceback": "  File \"/usr/local/lib/python3.9/site-packages/pulpcore/tasking/tasks.py\", line 68, in _execute_task\n    result = func(*args, **kwargs)\n  File \"/usr/local/lib/python3.9/site-packages/pulp_rpm/app/tasks/publishing.py\", line 346, in publish\n    repository_version = RepositoryVersion.objects.get(pk=repository_version_pk)\n  File \"/usr/local/lib/python3.9/site-packages/django/db/models/manager.py\", line 87, in manager_method\n    return getattr(self.get_queryset(), name)(*args, **kwargs)\n  File \"/usr/local/lib/python3.9/site-packages/django/db/models/query.py\", line 637, in get\n    raise self.model.DoesNotExist(\n",
    "description": "RepositoryVersion matching query does not exist."
  },
  "worker": "/pulp/api/v3/workers/019710eb-718b-729f-a421-5fc515b1ab9e/",
  "parent_task": null,
  "child_tasks": [],
  "task_group": null,
  "progress_reports": [],
  "created_resources": [],
  "reserved_resources_record": [
    "shared:prn:rpm.rpmrepository:01966302-194e-7ad1-8b5d-afc40c6e9c61",
    "shared:prn:core.domain:019513aa-8ee7-77d4-af49-eb445030ae0b"
  ]
}

Will this be still a SUSE to fix error?

This sounds like you are trying to publish a repository version that does not exist. It is a different error. Without knowing the exact workflow you performed, that is all I can say. Did you re-sync before publishing? Does the repository you are publishing contain any repository versions? What is your full workflow?

Thanks again quba42.

A 2nd run has gone through.
It is now building.

Something must have happened to the SUSE repo in the past month as the CiCd is the same.
Prior to this post on April10 it has been failing for a while.

Comparing <data type="updateinfo"> did not reveal any duplicates.

I’ll enjoy the idea of walking away from this.

2 Likes