fetch-lib error is useless/misleading
Metadata
Current evaluation
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).
Resolution: closed resolved
Reason: PR #2084 was merged as d0410f22 with the title 'better error message with fetch-lib' and directly references #1721. The maintainer linked the report to #1754, whose related fix merged in PR #2034 (c9b51038).
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
If I try to import a lib that doesn't exist, I get this:
```
Store operation failed:
- None: Items need to include 'library_id' or 'package_id'
Full execution log: ...
```
I can't figure out how to include a `library_id` or a `package_id` into the request, at least the help for `fetch-lib` doesn't help me at all.
I'd prefer that charmhub responded with something like "not found".
### To Reproduce
Any lib with wrong charm or lib name:
`charmcraft fetch-lib --verbosity=trace charms.cheese.v0.cheddar`
### Environment
macos and linux
3.0.0 and 2.7.0
### charmcraft.yaml
```shell
---
name: hexanator
type: charm
title: Charmed Gubernator
summary: High-performance, distributed rate-limiting service
description: |
Gubernator is a high-performance, distributed rate-limiting service.
# FIXME: move to 24.04 when there's a working Juju release
bases:
- build-on:
- name: ubuntu
channel: "22.04"
architectures: [amd64, arm64]
run-on:
- name: ubuntu
channel: "22.04"
architectures: [amd64, arm64, riscv64]
# FIXME: unused for now, push the log level into pebble config
config:
options:
log-level:
description: |
Acceptable values are: "info", "debug", "warning", "error" and "critical"
default: "info"
type: string
containers:
gubernator:
resource: gubernator
resources:
gubernator:
type: oci-image
description: Gubernator Rock with Pebble
# FIXME move to 3.0.0 even if still in beta
upstream-source: docker.io/dimaqq/gubernator:2.7.5
links:
source: https://github.com/gubernator-io/gubernator
requires:
ingress:
interface: ingress
limit: 1
```
### Relevant log output
```shell
2024-07-08 17:09:26.674 Starting charmcraft, version 3.0.0
2024-07-08 17:09:26.674 Log verbosity level set to BRIEF
2024-07-08 17:09:26.674 Raw pre-parsed sysargs: args={'help': False, 'verbose': False, 'quiet': False, 'verbosity': 'trace', 'version': False} filtered=['fetch-lib', 'charms.cheese.v0.cheddar']
2024-07-08 17:09:26.674 General parsed sysargs: command='fetch-lib' args=['charms.cheese.v0.cheddar']
2024-07-08 17:09:26.674 Configuring application...
2024-07-08 17:09:26.674 Preparing application...
2024-07-08 17:09:26.675 Command parsed sysargs: Namespace(format=None, library='charms.cheese.v0.cheddar')
2024-07-08 17:09:26.675 Build plan: platform=None, build_for=None
2024-07-08 17:09:26.675 Loading project file '/code/hexanator/charmcraft.yaml'
2024-07-08 17:09:26.677 Setting target machine to aarch64
2024-07-08 17:09:26.678 Running charmcraft fetch-lib on host
2024-07-08 17:09:26.678 HTTP 'POST' for 'https://api.charmhub.io/v1/charm/libraries/bulk' with params None and headers {'User-Agent': 'charmcraft/3.0.0 Darwin/23.5.0 (arm64) python/3.12.4'}
2024-07-08 17:09:27.720 Store operation failed:
- None: Items need to include 'library_id' or 'package_id'
2024-07-08 17:09:27.723 Traceback (most recent call last):
2024-07-08 17:09:27.723 File "/opt/homebrew/Cellar/charmcraft/3.0.0/libexec/lib/python3.12/site-packages/charmcraft/store/store.py", line 140, in error_decorator
2024-07-08 17:09:27.724 return method(self, *args, **kwargs)
2024-07-08 17:09:27.724 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-08 17:09:27.724 File "/opt/homebrew/Cellar/charmcraft/3.0.0/libexec/lib/python3.12/site-packages/charmcraft/store/store.py", line 463, in get_libraries_tips
2024-07-08 17:09:27.724 response = self._client.request_urlpath_json("POST", endpoint, json=payload)
2024-07-08 17:09:27.724 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-08 17:09:27.724 File "/opt/homebrew/Cellar/charmcraft/3.0.0/libexec/lib/python3.12/site-packages/charmcraft/store/client.py", line 64, in request_urlpath_json
2024-07-08 17:09:27.724 response = self._http_client.request(method, self.api_base_url + urlpath, *args, **kwargs)
2024-07-08 17:09:27.724 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-07-08 17:09:27.724 File "/opt/homebrew/Cellar/charmcraft/3.0.0/libexec/lib/python3.12/site-packages/craft_store/http_client.py", line 166, in request
2024-07-08 17:09:27.724 raise errors.StoreServerError(response)
2024-07-08 17:09:27.724 craft_store.errors.StoreServerError: Store operation failed:
2024-07-08 17:09:27.724 - None: Items need to include 'library_id' or 'package_id'
2024-07-08 17:09:27.724 Full execution log: '/Users/dima/Library/Logs/charmcraft/charmcraft-20240708-170926.673199.log'
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | 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). | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed in merged PR #2034 (commit c9b51038), which gives fetch-lib a clearer error for nonexistent libraries. The report was linked to #1754 as the same underlying bug. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed misleading fetch-lib errors for nonexistent libraries by PR #2034 (commit c9b51038), following its identification as related to #1754. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed and linked to issue #1754 as a shared underlying bug. The misleading fetch-lib error will be resolved separately with dedicated tests in the related issue. | |
| qwen/qwen3.6-35b-a3b | — | — | Closed as related to issue #1754. The misleading fetch-lib error shares the same underlying bug. A separate fix and test will be implemented for this report. | |
| qwen/qwen3.6-35b-a3b | — | — | Superseded by issue #1754 as a duplicate underlying bug. Resolution will be addressed in the referenced issue, with both requiring separate test coverage. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed and marked as related to #1754, which tracks the same underlying bug. Resolution is deferred to the linked issue, leaving the misleading error unfixed here. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/charmcraft#2084
(confidence 100%)
Merged commit d0410f22 directly references #1721 and improves the fetch-lib error.
-
Related To:
canonical/charmcraft#1754
(confidence 100%)
A maintainer identified it as probably the same underlying bug, but requiring separate tests.
-
Related To:
canonical/charmcraft#2034
(confidence 95%)
Merged PR #2034 fixed the related fetch-libs error in commit c9b51038.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #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. | |
| #2084 fix(store): better error message with fetch-lib | charmcraft | merged | Merged as commit d0410f22, improving fetch-lib errors and resolving #1721/CRAFT-3352. | |
| #1681 `fetch-libs` crashes with an internal error | charmcraft | closed | Fixed by merged PR #1701 (commit 3af2c248), which made fetch-libs handle library names containing underscores and resolved the crash. | |
| #2034 fix(store): nicer error message when getting nonexistent libs | charmcraft | merged | Merged PR #2034 (commit c9b51038), fixing #1754 by replacing Charmhub's unclear missing-library response with a clearer fetch-libs error. |