Skip to content

Error message with credential-process and a token is confusing. #12320

@ehuss

Description

@ehuss

Problem

If you are currently logged in to a registry using the typical token setting in credentials.toml, and you add a configuration for registry.credential-process, the error message when running cargo login is a little confusing:

error: both `token` and `credential-process` were specified in the config.
Only one of these values may be set, remove one or the other to proceed.

If a user is not following the instructions to the letter, or is not intimately familiar with cargo's auth setup, this doesn't really tell you what to do to fix the error.

Steps

  1. Do a normal login: cargo login
  2. Set up a credential process in config.toml:
    [registry]
    credential-process = "cargo:1password"
  3. Run cargo login -Zcredential-process

Possible Solution(s)

The error message could be a little clearer about what it means about a "token...in the config". A user may not know or equate that a legacy cargo login means that a "token is in the config". I would probably completely reword this error message to explain that they are logged in via the old mechanism, and that needs to be removed before using credential-process (though I'm not sure how to phrase "old mechanism").

I think the message could also include some instructions on how to fix it (such as running cargo logout).

Notes

No response

Version

cargo 1.72.0-nightly (03bc66b55 2023-06-23)
release: 1.72.0-nightly
commit-hash: 03bc66b55c290324bd46eb22e369c8fae1908f91
commit-date: 2023-06-23
host: aarch64-unknown-linux-gnu
libgit2: 1.6.4 (sys:0.17.2 vendored)
libcurl: 8.1.2-DEV (sys:0.4.63+curl-8.1.2 vendored ssl:OpenSSL/1.1.1u)
ssl: OpenSSL 1.1.1u  30 May 2023
os: Ubuntu 22.04 (jammy) [64-bit]

Metadata

Metadata

Assignees

Labels

A-credential-providerArea: credential provider for storing and retreiving credentialsA-diagnosticsArea: Error and warning messages generated by Cargo itself.C-bugCategory: bugS-needs-mentorStatus: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions