Launchpad: Handle invalid credentials files better
Metadata
Current evaluation
Enhancement to catch configparser errors from invalid Launchpad credentials files and retry login after deleting the file. Triaged by maintainer 2.5 years ago; code in launchpad.py still has no such handling. Inactive for ~7 months.
Suggested action: keep open
Reason: The issue is labeled 'Status: Triaged' and 'Type: Enhancement', the problem is still present in craft_application/launchpad/launchpad.py (no NoOptionError handling found via grep or code inspection), and the last activity was 215 days ago. It remains a valid, scoped enhancement that simply hasn't been picked up yet, so it should stay open rather than be closed as stale.
Impact:
35
Quick Win:
24.5
Staleness:
55
Complexity:
30
Confidence:
75
Support Request:
5
Issue body
### What needs to get done
If `Launchpad.login` errors out due to `configparser` issues, try deleting the credentials file and logging in again.
### Why it needs to get done
This isn't an acceptable error message:
```
+ charmcraft remote-build --verbose --launchpad-accept-public-upload
Starting charmcraft, version 2.5.5.post102+g0f95a52
Logging execution to '/root/.local/state/charmcraft/log/charmcraft-20240226-125356.635385.log'
remote-build is experimental and is subject to change. Use with caution.
charmcraft internal error: No option 'consumer_key' in section: '1'
Full execution log: '/root/.local/state/charmcraft/log/charmcraft-20240226-125356.635385.log'
Traceback (most recent call last):
File "/snap/charmcraft/x1/usr/lib/python3.10/configparser.py", line 791, in get
value = d[option]
File "/snap/charmcraft/x1/usr/lib/python3.10/collections/__init__.py", line 986, in __getitem__
return self.__missing__(key) # support subclasses that define __missing__
File "/snap/charmcraft/x1/usr/lib/python3.10/collections/__init__.py", line 978, in __missing__
raise KeyError(key)
KeyError: 'consumer_key'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/snap/charmcraft/x1/bin/charmcraft", line 8, in <module>
sys.exit(main())
File "/snap/charmcraft/x1/lib/python3.10/site-packages/charmcraft/application/main.py", line 150, in main
return app.run()
File "/snap/charmcraft/x1/lib/python3.10/site-packages/craft_application/application.py", line 465, in run
return_code = dispatcher.run() or 0
File "/snap/charmcraft/x1/lib/python3.10/site-packages/craft_cli/dispatcher.py", line 487, in run
return self._loaded_command.run(self._parsed_command_args)
File "/snap/charmcraft/x1/lib/python3.10/site-packages/craft_application/commands/base.py", line 171, in run
result = self._run(parsed_args, **kwargs) or result
File "/snap/charmcraft/x1/lib/python3.10/site-packages/charmcraft/application/commands/remote.py", line 110, in _run
builder = self._services.remote_build
File "/snap/charmcraft/x1/lib/python3.10/site-packages/craft_application/services/service_factory.py", line 95, in __getattr__
instance.setup()
File "/snap/charmcraft/x1/lib/python3.10/site-packages/craft_application/services/remotebuild.py", line 69, in setup
self.lp = self._get_lp_client()
File "/snap/charmcraft/x1/lib/python3.10/site-packages/craft_application/services/remotebuild.py", line 202, in _get_lp_client
return launchpad.Launchpad.login(
File "/snap/charmcraft/x1/lib/python3.10/site-packages/craft_application/launchpad/launchpad.py", line 98, in login
launchpadlib.launchpad.Launchpad.login_with(
File "/snap/charmcraft/x1/lib/python3.10/site-packages/launchpadlib/launchpad.py", line 700, in login_with
return cls._authorize_token_and_login(
File "/snap/charmcraft/x1/lib/python3.10/site-packages/launchpadlib/launchpad.py", line 445, in _authorize_token_and_login
cached_credentials = credential_store.load(
File "/snap/charmcraft/x1/lib/python3.10/site-packages/launchpadlib/credentials.py", line 345, in load
return self.do_load(unique_key)
File "/snap/charmcraft/x1/lib/python3.10/site-packages/launchpadlib/credentials.py", line 486, in do_load
return Credentials.load_from_path(self.filename)
File "/snap/charmcraft/x1/lib/python3.10/site-packages/lazr/restfulclient/authorize/oauth.py", line 229, in load_from_path
credentials.load(credentials_file)
File "/snap/charmcraft/x1/lib/python3.10/site-packages/lazr/restfulclient/authorize/oauth.py", line 205, in load
consumer_key = parser.get(CREDENTIALS_FILE_VERSION, "consumer_key")
File "/snap/charmcraft/x1/usr/lib/python3.10/configparser.py", line 794, in get
raise NoOptionError(option, section)
configparser.NoOptionError: No option 'consumer_key' in section: '1'
-----
.
2024-02-26 12:53:56 Restoring multipass:ubuntu-22.04-64:tests/spread/smoketests/remote-build:jammy (multipass:ubuntu-22.04-64)...
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.8-27b |
Impact:
35
Quick Win:
24.5
Staleness:
55
Complexity:
30
Confidence:
75
Support Request:
5
|
keep open | Enhancement to catch configparser errors from invalid Launchpad credentials files and retry login after deleting the file. Triaged by maintainer 2.5 years ago; code in launchpad.py still has no such handling. Inactive for ~7 months. | |
| qwen/qwen3.6-35b-a3b |
Staleness:
85
Complexity:
20
Confidence:
80
Support Request:
10
|
keep open | Enhancement to improve error handling for invalid Launchpad credentials files, suggesting deletion and re-login instead of crashing with a configparser error. Currently triaged but inactive for over 6 months. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
85
Complexity:
20
Confidence:
80
Support Request:
5
|
close stale | Enhancement to improve error handling for invalid Launchpad credentials files. Triaged but inactive for over two years with no progress or recent maintainer engagement. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
70
Complexity:
25
Confidence:
85
Support Request:
0
|
keep open | Handle invalid Launchpad credentials files by auto-deleting them and retrying login instead of crashing with a configparser error. Currently triaged and awaiting implementation. |
Update history
No update history recorded yet.
Related issues
No related issues found above the similarity threshold.