← Back to issue list

`fetch-libs` crashes with an internal error

View original Github issue

Metadata

Project
charmcraft
Number
#1681
Type
issue
State
closed
Author
jdkandersson
Labels
—
Created
Updated
Closed

Current evaluation

Fixed by merged PR #1701 (commit 3af2c248), which made fetch-libs handle library names containing underscores and resolved the crash.

Resolution: closed resolved

Reason: PR canonical/charmcraft#1701 was merged as commit 3af2c248 and explicitly resolves #1681. The change corrects fetch-libs handling of underscored library names.

Evaluated by: mr-cal-bot

No scores available.

Issue body

### Bug Description After logging in and running `fetch-libs`, there is an internal error `charmcraft internal error: StoreServerError("Store operation failed:\n- None: Items need to include 'library_id' or 'package_id'")` ### To Reproduce 1. Create a multipass VM 2. Install `latest/edge` of charmcraft 3. Include a `charm-libs` entry such as: ```yaml charm-libs: - lib: observability_libs.juju_topology version: 0 ``` 4. run `fetch-libs` ### Environment arm64 ubuntu jammy, charmcraft on `latest/edge` ### charmcraft.yaml ```shell # This file configures Charmcraft. # See https://juju.is/docs/sdk/charmcraft-config for guidance. name: sample-flask 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. extensions: - flask-framework charm-libs: - lib: observability_libs.juju_topology version: 0 # Uncomment the integrations used by your application # requires: # mysql: # interface: mysql_client # limit: 1 # postgresql: # interface: postgresql_client # limit: 1 ``` ### Relevant log output ```shell cat /home/ubuntu/.local/state/charmcraft/log/charmcraft-20240509-174417.997582.log 2024-05-09 17:44:17.998 Starting charmcraft, version 3.0.0.post39+ge2ad204 2024-05-09 17:44:17.998 Log verbosity level set to BRIEF 2024-05-09 17:44:17.998 Configuring application... 2024-05-09 17:44:17.998 Preparing application... 2024-05-09 17:44:17.998 Build plan: platform=None, build_for=None 2024-05-09 17:44:17.998 Loading project file '/home/ubuntu/src/sample-flask/charm/charmcraft.yaml' 2024-05-09 17:44:18.000 Processing grammar (on arm64 for arm64) 2024-05-09 17:44:18.000 Processing grammar for plugin: charm 2024-05-09 17:44:18.000 Processing grammar for source: . 2024-05-09 17:44:18.000 Running charmcraft fetch-libs on host 2024-05-09 17:44:18.000 Setting up StoreService 2024-05-09 17:44:18.074 Falling back to file based storage 2024-05-09 17:44:18.074 Getting library metadata from charmhub 2024-05-09 17:44:18.074 Retrieving credentials for 'charmcraft' on 'api.charmhub.io' from keyring 'auth FileKeyring'. 2024-05-09 17:44:18.074 HTTP 'POST' for 'https://api.charmhub.io/v1/charm/libraries/bulk' with params None and headers {'Authorization': '<macaroon>', 'User-Agent': 'Charmcraft/3.0.0.post39+ge2ad204 (Linux 5.15.0-106-generic; aarch64; CPython 3.10.12; Ubuntu 22.04)'} 2024-05-09 17:44:18.258 charmcraft internal error: StoreServerError("Store operation failed:\n- None: Items need to include 'library_id' or 'package_id'") 2024-05-09 17:44:18.265 Traceback (most recent call last): 2024-05-09 17:44:18.265 File "/snap/charmcraft/3739/lib/python3.10/site-packages/craft_application/application.py", line 517, in run 2024-05-09 17:44:18.265 return_code = dispatcher.run() or 0 2024-05-09 17:44:18.265 File "/snap/charmcraft/3739/lib/python3.10/site-packages/craft_cli/dispatcher.py", line 487, in run 2024-05-09 17:44:18.265 return self._loaded_command.run(self._parsed_command_args) 2024-05-09 17:44:18.265 File "/snap/charmcraft/3739/lib/python3.10/site-packages/charmcraft/application/commands/store.py", line 1679, in run 2024-05-09 17:44:18.265 libs_metadata = store.get_libraries_metadata_by_name(charm_libs) 2024-05-09 17:44:18.265 File "/snap/charmcraft/3739/lib/python3.10/site-packages/charmcraft/services/store.py", line 220, in get_libraries_metadata_by_name 2024-05-09 17:44:18.265 for lib in self.get_libraries_metadata(libraries) 2024-05-09 17:44:18.265 File "/snap/charmcraft/3739/lib/python3.10/site-packages/charmcraft/services/store.py", line 212, in get_libraries_metadata 2024-05-09 17:44:18.265 return self.client.fetch_libraries_metadata(store_libs) 2024-05-09 17:44:18.265 File "/snap/charmcraft/3739/lib/python3.10/site-packages/charmcraft/store/client.py", line 202, in fetch_libraries_metadata 2024-05-09 17:44:18.265 response = self.request_urlpath_json("POST", "/v1/charm/libraries/bulk", json=libs) 2024-05-09 17:44:18.265 File "/snap/charmcraft/3739/lib/python3.10/site-packages/charmcraft/store/client.py", line 134, in request_urlpath_json 2024-05-09 17:44:18.265 response = super().request(method, self.api_base_url + urlpath, *args, **kwargs) 2024-05-09 17:44:18.265 File "/snap/charmcraft/3739/lib/python3.10/site-packages/craft_store/base_client.py", line 186, in request 2024-05-09 17:44:18.265 return self.http_client.request( 2024-05-09 17:44:18.265 File "/snap/charmcraft/3739/lib/python3.10/site-packages/craft_store/http_client.py", line 166, in request 2024-05-09 17:44:18.265 raise errors.StoreServerError(response) 2024-05-09 17:44:18.265 craft_store.errors.StoreServerError: Store operation failed: 2024-05-09 17:44:18.265 - None: Items need to include 'library_id' or 'package_id' 2024-05-09 17:44:18.265 Full execution log: '/home/ubuntu/.local/state/charmcraft/log/charmcraft-20240509-174417.997582.log' ```

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Fixed by merged PR #1701 (commit 3af2c248), which made fetch-libs handle library names containing underscores and resolved the crash.
stealth/space-bunny-alpha — closed resolved Fixed the fetch-libs crash involving underscored library names in PR #1701 (commit 3af2c248). The report was initially linked to #1671.
stealth/space-bunny-alpha — closed resolved Fixed by canonical/charmcraft#1701, merged as 3af2c248, correcting underscore handling in fetch-libs.
qwen3.6-35b-a3b-mtp-q6 — — Closed as related to issue 1671. The fetch-libs crash from missing library identifiers was not directly fixed here; the maintainer linked to another issue for tracking and resolution.
qwen/qwen3.6-35b-a3b — — Superseded by issue #1671. The fetch-libs command crashed with a StoreServerError due to missing library_id or package_id in the API payload. Tracking continued in the linked issue.
qwen/qwen3.6-35b-a3b — — Closed as related to issue #1671. The fetch-libs command crashed with a StoreServerError due to missing library_id or package_id in metadata requests. Maintainer linked to a related discussion, indicating the issue is tracked elsewhere.
qwen3.6-35b-a3b-mtp-q6 — — Closed and superseded by issue #1671. The fetch-libs crash triggered by missing library identifiers was marked as a duplicate, with resolution deferred to the linked tracking issue.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/charmcraft#1701 (confidence 100%)

    Merged fix for underscored library names in commit 3af2c248.

  • Related To: canonical/charmcraft#1671 (confidence 95%)

    A maintainer linked this crash report to the earlier fetch-libs login discussion.

Related issues

Issue Project State Summary Similarity
#1701 fix: make fetch-libs + underscores work charmcraft merged Merged PR #1701 via commit 3af2c248, fixing fetch-libs handling of underscored library names and resolving #1681.
83%
#1754 `fetch-libs` has weird error messages when libs aren't available charmcraft closed Fixed misleading fetch-libs errors for unavailable libraries in merged PR #2034 (commit c9b51038), with a clearer missing-library message.
79%
#1721 fetch-lib error is useless/misleading charmcraft closed Fixed by merged PR #2084 (d0410f22), adding a clear fetch-lib error for unavailable libraries; the related fetch-libs case was fixed in #2034 (c9b51038).
73%
#1702 fix: allow fetch-libs to work without logging in charmcraft merged Merged PR #1702 as commit 1da46c8f, allowing fetch-libs to run without logging in and addressing #1681.
72%