Confusing output from `charmcraft login`
Metadata
Current evaluation
Reported confusing charmcraft login error when credentials already exist. Team agreed to improve messaging to prompt users to logout first. Issue closed and superseded by tracking issue #833 to implement the fix.
Suggested action: —
No scores available.
Issue body
When packing and uploading a charm just now I got some very confusing output:
```
mthaddon@tenaya:~/repos/jenkins-charm/jenkins-charm$ charmcraft pack
Packing the charm
Created 'jenkins_ubuntu-16.04-amd64_ubuntu-18.04-amd64_ubuntu-20.04-amd64.charm'.
Charms packed:
jenkins_ubuntu-16.04-amd64_ubuntu-18.04-amd64_ubuntu-20.04-amd64.charm
mthaddon@tenaya:~/repos/jenkins-charm/jenkins-charm$ charmcraft login
craft-store error: Credentials found for 'charmcraft' on 'api.charmhub.io'.
Full execution log: '/home/mthaddon/snap/charmcraft/common/cache/charmcraft/log/charmcraft-20220722-082942.042997.log'
mthaddon@tenaya:~/repos/jenkins-charm/jenkins-charm$ echo $?
1
mthaddon@tenaya:~/repos/jenkins-charm/jenkins-charm$ charmcraft upload jenkins_ubuntu-16.04-amd64_ubuntu-18.04-amd64_ubuntu-20.04-amd64.charm
Existing credentials no longer valid. Trying to log in... \ (5.3s) O
pening an authorization web page in your browser.
If it does not open, please open this URL:
https://api.jujucharms.com/identity/login?did=REDACTED
Revision 39 of 'jenkins' created
mthaddon@tenaya:~/repos/jenkins-charm/jenkins-charm$
```
Why did `charmcraft login` fail saying `credentials found` but then I still had to login?
The execution log is as follows:
```
2022-07-22 08:29:42.043 Starting charmcraft version 1.7.1
2022-07-22 08:29:42.043 Raw pre-parsed sysargs: args={'help': False, 'verbose': False, 'quiet': False, 'trace': False, 'project_dir': None} filtered=['login']
2022-07-22 08:29:42.043 General parsed sysargs: command='login' args=[]
2022-07-22 08:29:42.047 Command parsed sysargs: Namespace(bundle=None, channel=None, charm=None, export=None, permission=None, ttl=None)
2022-07-22 08:29:42.047 System details: OSPlatform(system='ubuntu', release='20.04', machine='x86_64'); Environment: DESKTOP_SESSION='ubuntu', XDG_CURRENT_DESKTOP='ubuntu:GNOME'
2022-07-22 08:29:42.237 craft-store error: Credentials found for 'charmcraft' on 'api.charmhub.io'.
2022-07-22 08:29:42.237 Full execution log: '/home/mthaddon/snap/charmcraft/common/cache/charmcraft/log/charmcraft-20220722-082942.042997.log'
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen3.6-35b-a3b-mtp-q6 | — | — | Reported confusing charmcraft login error when credentials already exist. Team agreed to improve messaging to prompt users to logout first. Issue closed and superseded by tracking issue #833 to implement the fix. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed and superseded by tracking issue #833. The confusing charmcraft login error regarding existing but potentially invalid credentials will be addressed by improving the error message and suggesting a logout resolution in the new ticket. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed and superseded by issue #833. The confusing charmcraft login error message was not fixed here. Maintainers will track the error handling improvement separately. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed and superseded by issue #833. Developers will improve the error message when charmcraft login fails due to existing credentials, guiding users to log out first. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #916 (charmhub) Provide a better error to the user on a login attempt when already having credentials (CRAFT-1269) | charmcraft | merged | Merged changes that improve Charmhub login error messaging when credentials already exist, resolving issue #833 and ticket CRAFT-1269. Approved by one reviewer with minimal code modifications. | |
| #725 craft-store error when using `charmcraft login` command | charmcraft | closed | Closed as superseded by #833. The error triggers when charmhub credentials already exist. Maintainers acknowledged the confusing UX and planned a craft-store fix, but redirected tracking to the dedicated ticket. | |
| #759 charmcraft login produces an error | charmcraft | closed | Closed as superseded by issue #833. The duplicate login error will be improved with clearer guidance and suggested fixes. No code changes applied in this report. | |
| #901 Charmcraft login on remote device has unhelpful error message | charmcraft | closed | Closed. The unhelpful remote login error is tracked upstream in craft-store issue #58, as the fix requires changes to the underlying authentication library rather than Charmcraft itself. | |
| #672 charmcraft 1.4.0: impossible to login to charmhub | charmcraft | closed | Closed as expected behavior. Charmcraft falls back to a non-persistent memory ring on headless systems lacking a keyring, preventing credential persistence. Maintainers advised exporting credentials via environment variables instead of implementing a code fix. | |
| #190 charmcraft whoami tries to login | charmcraft | closed | Closed without resolution, likely abandoned. The charmcraft whoami command incorrectly triggered a login flow when unauthenticated instead of displaying a not logged in status. |