Deploying to package registry in self-hosted GitLab instance

Problem to solve

I’m trying to deploy to GitLab package registry on a self-hosted GitLab instance.

While this succeeds on testpypi, via
twine upload --repository testpypi dist/*

it fails on my self-hosted GitLab instance.
What I’m getting as error message is:

400 Bad Request
INFO {“error”:“content is invalid”}

If I look into apache logs on my server running the GitLab instance I see the upload request and the response, however, I’m missing the reason and methods how to find it.

If I enter
I get

{“error”:“package_id is invalid”}


Please select whether options apply, and add the version information.

  • Self-managed, 17.0.2


Any help is appreciated.

See this for solution, which worked for me.