Skip to content

Unhelpful cloudfront error when using bad API token #11571

Closed
@Boddlnagg

Description

@Boddlnagg

Current Behavior

I (unintentionally and without noticing) entered a bad API token via cargo login (see below). Then cargo publish and cargo owner, including cargo owner --list, give the following error:

> cargo owner --list windows
    Updating crates.io index
error: failed to list owners of crate `windows` on registry at https://crates.io

  failed to get a 200 OK response, got 400
  headers:
        HTTP/2 400
        content-length: 0
        server: nginx
        date: Sun, 08 Jan 2023 17:06:47 GMT
        strict-transport-security: max-age=31536000; includeSubDomains
        via: 1.1 vegur, 1.1 319f376925908156190f5fc160137b42.cloudfront.net (CloudFront)
        x-cache: Error from cloudfront
        x-amz-cf-pop: FRA60-P3
        x-amz-cf-id: eclND8Emct0Dx-QEsF7G9Wn4NP_6iHfFegsmX7UxsQxr1X89yRw6og==

  body:

The credentials file ended up looking like this after I hit Ctrl+V to insert my token on the command line (and at first I didn't notice that this didn't work correctly):

[registry]
token = "\u0016"

Expected Behavior

A more helpful error message that tells me that my API token is wrong or ill-formed.

Steps To Reproduce

No response

Environment

Windows 10, using PowerShell within Windows Terminal or VS Code

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Error and warning messages generated by Cargo itself.A-interacts-with-crates.ioArea: interaction with registriesA-registry-authenticationArea: registry authentication and authorization (authn authz)C-bugCategory: bugE-easyExperience: Easy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions