Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetch-lib error is useless/misleading #1721

Closed
dimaqq opened this issue Jul 8, 2024 · 2 comments · Fixed by #2084
Closed

fetch-lib error is useless/misleading #1721

dimaqq opened this issue Jul 8, 2024 · 2 comments · Fixed by #2084
Assignees
Labels
Bug Something isn't working triaged

Comments

@dimaqq
Copy link
Contributor

dimaqq commented Jul 8, 2024

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

---
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

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'
Copy link

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-3352.

This message was autogenerated

@lengau
Copy link
Collaborator

lengau commented Sep 9, 2024

Thanks for the report! I've marked this as related to #1754 since they're probably the same underlying bug, but they'll need separate tests for fixes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants