Skip to content

Twine upload fails with unhelpful error #897

@jaraco

Description

@jaraco

Attempting to upload a release, I get a "warning" error.

setuptools main $ .tox/release/bin/python -m twine upload dist/*
Uploading distributions to https://upload.pypi.org/legacy/
Uploading setuptools-62.1.0-py3-none-any.whl
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB • 00:00 • 6.8 MB/s
WARNING  Error during upload. Retry with the --verbose option for more details.                                                                

Is it an error or a warning? Why make me retry to get some useful information? Retry with verbose does reveal the cause:

setuptools main $ .tox/release/bin/python -m twine upload dist/* --verbose
Uploading distributions to https://upload.pypi.org/legacy/
INFO     dist/setuptools-62.1.0-py3-none-any.whl (1.1 MB)                                                                                      
INFO     dist/setuptools-62.1.0.tar.gz (2.4 MB)                                                                                                
INFO     username set by command options                                                                                                       
INFO     Querying keyring for password                                                                                                         
INFO     password set from keyring                                                                                                             
INFO     username: __token__                                                                                                                   
INFO     password: <hidden>                                                                                                                    
Uploading setuptools-62.1.0-py3-none-any.whl
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB • 00:00 • 5.2 MB/s
INFO     Response from https://upload.pypi.org/legacy/:                                                                                        
         400 File already exists. See https://pypi.org/help/#file-name-reuse for more information.                                             
INFO     <html>                                                                                                                                
          <head>                                                                                                                               
           <title>400 File already exists. See https://pypi.org/help/#file-name-reuse for more information.</title>                            
          </head>                                                                                                                              
          <body>                                                                                                                               
           <h1>400 File already exists. See https://pypi.org/help/#file-name-reuse for more information.</h1>                                  
           The server could not comply with the request since it is either malformed or otherwise incorrect.<br/><br/>                         
         File already exists. See https://pypi.org/help/#file-name-reuse for more information.                                                 
                                                                                                                                               
                                                                                                                                               
          </body>                                                                                                                              
         </html>                   

It seems to me twine should provide more useful details on a failed upload during the initial attempt. If the issue was transient, I wouldn't be able to recreate it in a second attempt. Especially for known failure cases, Twine should detect them and report useful information during the initial attempt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions