Skip to content

uv publish --check-url fails for missing package 404 #19459

Description

@peter-facko

Summary

uv publish --check-url fails with

error: Failed to query check URL
  Caused by: Unsupported `Content-Type` "text/plain" for https://gitlab.example.org/api/v4/projects/1234/packages/pypi/simple/example-package/. Expected JSON or HTML.

in GitLab when the package doesn't exist. It should just upload the package in that case and not fail.

Platform

Linux 7.0.5-arch1-1 x86_64 GNU/Linux

Version

uv 0.11.14 (3fdfdc7 2026-05-12 x86_64-unknown-linux-gnu)

Python version

Python 3.13.12

Activity

  1. woodruffw commented on May 18, 2026

    @woodruffw
    Member

    I'm not 100% sure we should upload the package in that case -- it's not correct for a simple index to respond with text/plain (per the specs, it MUST respond with one of an HTML or JSON content type that we understand, including one of the vnd.pypi ones).

    Could you share an MRE for this? It would be helpful to have a public link to a GitLab index that demonstrates this content type.

    (Note that this isn't related to 404 handling; the actual error here is in our content-type expectation.)

  2. added
    needs-mreNeeds more information for reproduction, see #9452
    on May 18, 2026
  3. peter-facko commented on May 18, 2026

    @peter-facko
    Author

    @woodruffw, thank you for the response. You're right, I didn't read the error carefully.

    Actually I noticed that GitLab redirects to PyPI, so the example is just

  4. woodruffw commented on May 18, 2026

    @woodruffw
    Member

    Actually I noticed that GitLab redirects to PyPI, so the example is just

    That doesn't reproduce:

    % curl -s -I https://pypi.org/simple/uv/ | grep content-type  
    content-type: text/html
    x-content-type-options: nosniff
    
  5. woodruffw commented on May 18, 2026

    @woodruffw
    Member

    Oh hmm, it reproduces for the 404 case:

    % curl -s -I https://pypi.org/simple/non-existent/ | grep content-type
    content-type: text/plain; charset=UTF-8
    x-content-type-options: nosniff
    

    I'm surprised we don't handle the 404 case specially. I'll defer to @konstin for that 🙂

  6. added a commit that references this issue on May 28, 2026
    5a0b932
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingneeds-mreNeeds more information for reproduction, see #9452

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions