← Back to issue list

`fetch-libs` command requires being logged into charmhub

View original Github issue

Metadata

Project
charmcraft
Number
#1671
Type
issue
State
closed
Author
lengau
Labels
Created
Updated
Closed

Current evaluation

Closed without a documented fix, likely abandoned. Investigation identified a conflicting API validation for charm name hyphens versus underscores, but no resolution or code changes were implemented.

Suggested action:

No scores available.

Issue body

### Bug Description The `fetch-libs` command uses a logged in charmhub session, though it doesn't need to. ### To Reproduce 1. Create a fresh VM/container 2. Add one or more libraries to a new charm 3. Run `charmcraft fetch-libs` Expected: Libraries are collected Actual: Requests login ### Environment n/a ### charmcraft.yaml ```shell name: cc-1654 type: charm bases: - build-on: - name: ubuntu channel: "22.04" run-on: - name: ubuntu channel: "22.04" # (Required) summary: A very short one-line summary of the flask application. # (Required) description: | A comprehensive overview of your Flask application. ] charm-libs: - lib: mysql.mysql version: 0 ``` ### Relevant log output ```shell 2024-05-07 10:17:58.552 Getting library metadata from charmhub 2024-05-07 10:17:58.552 Retrieving credentials for 'charmcraft' on 'api.charmhub.io' from keyring 'SecretService Keyring'. 2024-05-07 10:17:58.553 Credentials not found in the keyring 'SecretService Keyring' 2024-05-07 10:17:58.553 charmcraft internal error: CredentialsUnavailable("No credentials found for 'charmcraft' on 'api.charmhub.io'.") 2024-05-07 10:17:58.554 Traceback (most recent call last): 2024-05-07 10:17:58.554 File "/snap/charmcraft/3643/lib/python3.10/site-packages/craft_application/application.py", line 510, in run 2024-05-07 10:17:58.554 return_code = dispatcher.run() or 0 2024-05-07 10:17:58.554 File "/snap/charmcraft/3643/lib/python3.10/site-packages/craft_cli/dispatcher.py", line 487, in run 2024-05-07 10:17:58.554 return self._loaded_command.run(self._parsed_command_args) 2024-05-07 10:17:58.554 File "/snap/charmcraft/3643/lib/python3.10/site-packages/charmcraft/application/commands/store.py", line 1676, in run 2024-05-07 10:17:58.554 libs_metadata = store.get_libraries_metadata_by_name(charm_libs) 2024-05-07 10:17:58.554 File "/snap/charmcraft/3643/lib/python3.10/site-packages/charmcraft/services/store.py", line 220, in get_libraries_metadata_by_name 2024-05-07 10:17:58.554 for lib in self.get_libraries_metadata(libraries) 2024-05-07 10:17:58.554 File "/snap/charmcraft/3643/lib/python3.10/site-packages/charmcraft/services/store.py", line 212, in get_libraries_metadata 2024-05-07 10:17:58.554 return self.client.fetch_libraries_metadata(store_libs) 2024-05-07 10:17:58.554 File "/snap/charmcraft/3643/lib/python3.10/site-packages/charmcraft/store/client.py", line 202, in fetch_libraries_metadata 2024-05-07 10:17:58.554 response = self.request_urlpath_json("POST", "/v1/charm/libraries/bulk", json=libs) 2024-05-07 10:17:58.554 File "/snap/charmcraft/3643/lib/python3.10/site-packages/charmcraft/store/client.py", line 134, in request_urlpath_json 2024-05-07 10:17:58.554 response = super().request(method, self.api_base_url + urlpath, *args, **kwargs) 2024-05-07 10:17:58.554 File "/snap/charmcraft/3643/lib/python3.10/site-packages/craft_store/base_client.py", line 184, in request 2024-05-07 10:17:58.554 headers["Authorization"] = self._get_authorization_header() 2024-05-07 10:17:58.554 File "/snap/charmcraft/3643/lib/python3.10/site-packages/craft_store/store_client.py", line 108, in _get_authorization_header 2024-05-07 10:17:58.554 auth = creds.unmarshal_candid_credentials(self._auth.get_credentials()) 2024-05-07 10:17:58.554 File "/snap/charmcraft/3643/lib/python3.10/site-packages/craft_store/auth.py", line 277, in get_credentials 2024-05-07 10:17:58.554 raise errors.CredentialsUnavailable(self.application_name, self.host) 2024-05-07 10:17:58.554 craft_store.errors.CredentialsUnavailable: No credentials found for 'charmcraft' on 'api.charmhub.io'. ```

Evaluation history

Date Model Scores Action Summary
qwen3.6-35b-a3b-mtp-q6 Closed without a documented fix, likely abandoned. Investigation identified a conflicting API validation for charm name hyphens versus underscores, but no resolution or code changes were implemented.
qwen/qwen3.6-35b-a3b Closed without resolution. An internal ticket was created, but no fix was implemented. The issue appears abandoned after a contributor noted a related API validation mismatch.
qwen/qwen3.6-35b-a3b Closed after an internal Jira ticket (CRAFT-2878) was created to track the bug. A related charm name validation conflict with the Charmhub API was noted. No public fix or resolution is documented.
qwen3.6-35b-a3b-mtp-q6 The fetch-libs command incorrectly required Charmhub authentication. The issue was closed without a documented fix. Investigation noted a conflicting API validation rule for charm names.
qwen3.6-35b-a3b-mtp-q6 Closed without resolution. A related validation conflict between charmcraft and the Charmhub API was identified, but the issue was abandoned without a fix.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1788 `fetch-lib` should work from anywhere charmcraft open charmcraft fetch-lib (3.1.1+) requires a charmcraft.yaml and fails outside a charm project, breaking workflows that fetch libs for inspection. Maintainer acknowledged Sep 2024, explicitly kept it open but deferred past that pulse; charmlibs commands are now deprecated in favor of Python packages.
74%
#284 Running `charmcraft fetch-lib` on a charm with dashes should fetch to a path with underscores charmcraft closed Closed without resolution. The request to automatically convert dashes to underscores in fetched library paths was acknowledged but never implemented, leaving the issue abandoned.
73%