Pypi Repository Package Doesn't Override Packages With The Same Version

I have configured a PyPy package manager for my repository
and tried to upload the same package version with the save version more than once

When I have executed the following command:
python3 -m twine upload --repository gitlab dist/

I have received the following error:
Content received from server:
{“message”:“Validation failed: File name has already been taken”}
HTTPError: 400 Bad Request from https://gitlab.com/api/v4/projects/19660947/packages/pypi
Bad Request

In the GitLab documentation it states that the packages with the same versions are being replaced:
https://docs.gitlab.com/ee/user/packages/pypi_repository/index.html#uploading-packages

1 Like

May i ask what version u are using? I can’t get the package manger enabled on gitlab CE.
Edit: https://gitlab.com/help/user/packages/index states that we have it after release of 13.3.

Hi,

this sounds like a bug to me, especially since it responds with 400/bad request. Can you re-test this again (might be fixed since GitLab.com is a rolling release to production every day). If the issue persists, please go ahead and create a bug report. Thanks! :slight_smile:

Cheers,
Michael

2 Likes

Just happened to me. Using almost the same setting than cbdan.

You can’t do that.

When publishing packages, note that:

  • The maximum allowed size is 50 MB.
  • You can’t upload the same version of a package multiple times. If you try, you receive the error Validation failed: File name has already been taken.

Read the original doc

1 Like

I had the same issue, adding “–skip-existing” to the end of the command worked for me

That fixes the command but I do not want it to just skip existing packages. I want twine to be able to overwrite the existing package version. I think the only way to do this unfortunately is to either have a minor bump in the version (maybe based on git commit sha) or delete the package from the registry before uploading a new one

Getting this same issue trying to replace a file in one of my packages. Even if I go into the gitlab package registry and delete the file I want to overwrite, when I go to upload a new file I still get the error telling me the file name has already been taken.

I shouldn’t have to wipe the whole package just to overwrite one file in the package, but that’s the only thing I’ve found that works.

From the docs:

You cannot publish a package if a package of the same name and version already exists. You must delete the existing package first. If you attempt to publish the same package more than once, a 400 Bad Request error occurs.

I get that I can’t publish the same package multiple times, but I should be able to overwrite specific files in that package, especially if I’ve already deleted the files.

1 Like