← Back to issue list

[3.4.3] Charmcraft fetch-lib fails with `Library None not found in Charmhub.`

View original Github issue

Metadata

Project
charmcraft
Number
#2204
Type
issue
State
open
Author
phvalguima
Labels
Type: Bug
Created
Updated
Closed

Current evaluation

fetch-lib (all) fails with cryptic 'Library None not found in Charmhub' when a local lib is unpublished; maintainers confirmed the cause and unhelpful message, but the buggy error path in store.py remains unfixed in current code.

Suggested action: keep open

Reason: Maintainers lucabello and DnPlas confirmed the root cause (unpublished lib with a fake/invalid LIBID) and agreed the message is unhelpful, so it is triaged and valid. I verified the current code at store.py:1605 still raises `Library {parsed_args.library} not found in Charmhub` inside the per-lib loop, so the bug is reproducible and not stale-irrelevant; a Copilot auto-fix attempt on 2025-12-03 failed on token permissions, leaving no fix PR.

Impact: 45 Quick Win: 31.5 Staleness: 60 Complexity: 30 Confidence: 85 Support Request: 10

Issue body

### Bug Description I am using charmcraft: `installed: 3.4.3.post51+g6153055c (6228) 60MB classic` Installed from channel `latest/edge` We have done some few changes in the OpenSearch libs and now the `check_libs` started failing with an error instead of simply a list of outdated libs. Running it locally and I can also reproduce the same error. This error message is not really helpful and the logs print the entire lib content, making it hard to read. ### To Reproduce $ git clone https://github.com/canonical/opensearch-operator -b 2/edge $ cd opensearch-operator $ charmcraft fetch-lib Library None not found in Charmhub. ### Environment OS: 24.04 charmcraft: latest/edge, currently on 3.4.3 ### charmcraft.yaml ```yaml # Copyright 2022 Canonical Ltd. # See LICENSE file for licensing details. type: charm platforms: ubuntu@22.04:amd64: ubuntu@24.04:amd64: # Files implicitly created by charmcraft without a part: # - dispatch (https://github.com/canonical/charmcraft/pull/1898) # - manifest.yaml # (https://github.com/canonical/charmcraft/blob/9ff19c328e23b50cc06f04e8a5ad4835740badf4/charmcraft/services/package.py#L259) # Files implicitly copied/"staged" by charmcraft without a part: # - actions.yaml, config.yaml, metadata.yaml # (https://github.com/canonical/charmcraft/blob/9ff19c328e23b50cc06f04e8a5ad4835740badf4/charmcraft/services/package.py#L290-L293 # https://github.com/canonical/charmcraft/blob/9ff19c328e23b50cc06f04e8a5ad4835740badf4/charmcraft/services/package.py#L156-L157) parts: # "poetry-deps" part name is a magic constant # https://github.com/canonical/craft-parts/pull/901 poetry-deps: plugin: nil build-packages: - curl override-build: | # Use environment variable instead of `--break-system-packages` to avoid failing on older # versions of pip that do not recognize `--break-system-packages` # `--user` needed (in addition to `--break-system-packages`) for Ubuntu >=24.04 PIP_BREAK_SYSTEM_PACKAGES=true python3 -m pip install --user --upgrade pip==24.3.1 # renovate: charmcraft-pip-latest # Use uv to install poetry so that a newer version of Python can be installed if needed by poetry curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.5.15/uv-installer.sh | sh # renovate: charmcraft-uv-latest # poetry 2.0.0 requires Python >=3.9 if ! "$HOME/.local/bin/uv" python find '>=3.9' then # Use first Python version that is >=3.9 and available in an Ubuntu LTS # (to reduce the number of Python versions we use) "$HOME/.local/bin/uv" python install 3.10.12 # renovate: charmcraft-python-ubuntu-22.04 fi "$HOME/.local/bin/uv" tool install --no-python-downloads --python '>=3.9' poetry==2.0.0 --with poetry-plugin-export==1.8.0 # renovate: charmcraft-poetry-latest ln -sf "$HOME/.local/bin/poetry" /usr/local/bin/poetry # "charm-poetry" part name is arbitrary; use for consistency # Avoid using "charm" part name since that has special meaning to charmcraft charm-poetry: # By default, the `poetry` plugin creates/stages these directories: # - lib, src # (https://github.com/canonical/charmcraft/blob/9ff19c328e23b50cc06f04e8a5ad4835740badf4/charmcraft/parts/plugins/_poetry.py#L76-L78) # - venv # (https://github.com/canonical/charmcraft/blob/9ff19c328e23b50cc06f04e8a5ad4835740badf4/charmcraft/parts/plugins/_poetry.py#L95 # https://github.com/canonical/craft-parts/blob/afb0d652eb330b6aaad4f40fbd6e5357d358de47/craft_parts/plugins/base.py#L270) plugin: poetry source: . after: - poetry-deps poetry-export-extra-args: ['--only', 'main,charm-libs'] build-packages: - libffi-dev # Needed to build Python dependencies with Rust from source - libssl-dev # Needed to build Python dependencies with Rust from source - pkg-config # Needed to build Python dependencies with Rust from source override-build: | # Workaround for https://github.com/canonical/charmcraft/issues/2068 # rustup used to install rustc and cargo, which are needed to build Python dependencies with Rust from source if [[ "$CRAFT_PLATFORM" == ubuntu@20.04:* || "$CRAFT_PLATFORM" == ubuntu@22.04:* ]] then snap install rustup --classic else apt-get install rustup -y fi # If Ubuntu version < 24.04, rustup was installed from snap instead of from the Ubuntu # archive—which means the rustup version could be updated at any time. Print rustup version # to build log to make changes to the snap's rustup version easier to track rustup --version # rpds-py (Python package) >=0.19.0 requires rustc >=1.76, which is not available in the # Ubuntu 22.04 archive. Install rustc and cargo using rustup instead of the Ubuntu archive rustup set profile minimal rustup default 1.83.0 # renovate: charmcraft-rust-latest craftctl default # Include requirements.txt in *.charm artifact for easier debugging cp requirements.txt "$CRAFT_PART_INSTALL/requirements.txt" # "files" part name is arbitrary; use for consistency files: plugin: dump source: . build-packages: - git override-build: | # Workaround to add unique identifier (git hash) to charm version while specification # DA053 - Charm versioning # (https://docs.google.com/document/d/1Jv1jhWLl8ejK3iJn7Q3VbCIM9GIhp8926bgXpdtx-Sg/edit?pli=1) # is pending review. python3 -c 'import pathlib; import shutil; import subprocess; git_hash=subprocess.run(["git", "describe", "--always", "--dirty"], capture_output=True, check=True, encoding="utf-8").stdout; file = pathlib.Path("charm_version"); shutil.copy(file, pathlib.Path("charm_version.backup")); version = file.read_text().strip(); file.write_text(f"{version}+{git_hash}")' craftctl default stage: - LICENSE - charm_version - workload_version ``` ### Relevant log output ```shell $ cat .../charmcraft-20250305-165748.716373.log 2025-03-05 16:57:48.717 Starting charmcraft, version 3.4.3.post51+g6153055c 2025-03-05 16:57:48.717 Log verbosity level set to BRIEF 2025-03-05 16:57:48.717 Preparing application... 2025-03-05 16:57:48.717 Configuring application... 2025-03-05 16:57:48.718 Setting up ConfigService 2025-03-05 16:57:48.730 Build plan: platform=None, build_for=None 2025-03-05 16:57:48.731 Loading project file '/home/pguimaraes/Documents/Canonical/Engineering/DPE-6765-restart-node-not-up/opensearch-operator/charmcraft.yaml' 2025-03-05 16:57:48.751 Using parallel build count of 8 from CPU count 2025-03-05 16:57:48.751 Processing grammar (on amd64 for amd64) 2025-03-05 16:57:48.751 Processing grammar for plugin: nil 2025-03-05 16:57:48.751 Processing grammar for build-packages: ['curl'] 2025-03-05 16:57:48.751 Processing grammar for override-build: # Use environment variable instead of `--break-system-packages` to avoid failing on older # versions of pip that do not recognize `--break-system-packages` # `--user` needed (in addition to `--break-system-packages`) for Ubuntu >=24.04 PIP_BREAK_SYSTEM_PACKAGES=true python3 -m pip install --user --upgrade pip==24.3.1 # renovate: charmcraft-pip-latest # Use uv to install poetry so that a newer version of Python can be installed if needed by poetry curl --proto '=https' --tlsv1.2 -LsSf https://github.com/astral-sh/uv/releases/download/0.5.15/uv-installer.sh | sh # renovate: charmcraft-uv-latest # poetry 2.0.0 requires Python >=3.9 if ! "$HOME/.local/bin/uv" python find '>=3.9' then # Use first Python version that is >=3.9 and available in an Ubuntu LTS # (to reduce the number of Python versions we use) "$HOME/.local/bin/uv" python install 3.10.12 # renovate: charmcraft-python-ubuntu-22.04 fi "$HOME/.local/bin/uv" tool install --no-python-downloads --python '>=3.9' poetry==2.0.0 --with poetry-plugin-export==1.8.0 # renovate: charmcraft-poetry-latest ln -sf "$HOME/.local/bin/poetry" /usr/local/bin/poetry 2025-03-05 16:57:48.751 Processing grammar for plugin: poetry 2025-03-05 16:57:48.751 Processing grammar for source: . 2025-03-05 16:57:48.751 Processing grammar for after: ['poetry-deps'] 2025-03-05 16:57:48.751 Not processing grammar for non-grammar enabled keyword poetry-export-extra-args 2025-03-05 16:57:48.751 Processing grammar for build-packages: ['libffi-dev', 'libssl-dev', 'pkg-config'] 2025-03-05 16:57:48.751 Processing grammar for override-build: # Workaround for https://github.com/canonical/charmcraft/issues/2068 # rustup used to install rustc and cargo, which are needed to build Python dependencies with Rust from source if [[ "$CRAFT_PLATFORM" == ubuntu@20.04:* || "$CRAFT_PLATFORM" == ubuntu@22.04:* ]] then snap install rustup --classic else apt-get install rustup -y fi # If Ubuntu version < 24.04, rustup was installed from snap instead of from the Ubuntu # archive—which means the rustup version could be updated at any time. Print rustup version # to build log to make changes to the snap's rustup version easier to track rustup --version # rpds-py (Python package) >=0.19.0 requires rustc >=1.76, which is not available in the # Ubuntu 22.04 archive. Install rustc and cargo using rustup instead of the Ubuntu archive rustup set profile minimal rustup default 1.83.0 # renovate: charmcraft-rust-latest craftctl default # Include requirements.txt in *.charm artifact for easier debugging cp requirements.txt "$CRAFT_PART_INSTALL/requirements.txt" 2025-03-05 16:57:48.751 Processing grammar for plugin: dump 2025-03-05 16:57:48.751 Processing grammar for source: . 2025-03-05 16:57:48.751 Processing grammar for build-packages: ['git'] 2025-03-05 16:57:48.751 Processing grammar for override-build: # Workaround to add unique identifier (git hash) to charm version while specification # DA053 - Charm versioning # (https://docs.google.com/document/d/1Jv1jhWLl8ejK3iJn7Q3VbCIM9GIhp8926bgXpdtx-Sg/edit?pli=1) # is pending review. python3 -c 'import pathlib; import shutil; import subprocess; git_hash=subprocess.run(["git", "describe", "--always", "--dirty"], capture_output=True, check=True, encoding="utf-8").stdout; file = pathlib.Path("charm_version"); shutil.copy(file, pathlib.Path("charm_version.backup")); version = file.read_text().strip(); file.write_text(f"{version}+{git_hash}")' craftctl default 2025-03-05 16:57:48.751 Processing grammar for stage: ['LICENSE', 'charm_version', 'workload_version'] 2025-03-05 16:57:48.755 Running charmcraft fetch-lib on host 2025-03-05 16:57:48.879 Libraries found under 'lib/charms': ['charms.data_platform_libs.v0.data_interfaces', 'charms.data_platform_libs.v0.object_storage', 'charms.data_platform_libs.v0.s3', 'charms.grafana_agent.v0.cos_agent', 'charms.opensearch.v0.constants_charm', 'charms.opensearch.v0.constants_secrets', 'charms.opensearch.v0.constants_tls', 'charms.opensearch.v0.helper_charm', 'charms.opensearch.v0.helper_cluster', 'charms.opensearch.v0.helper_conf_setter', 'charms.opensearch.v0.helper_cos', 'charms.opensearch.v0.helper_enums', 'charms.opensearch.v0.helper_http', 'charms.opensearch.v0.helper_networking', 'charms.opensearch.v0.helper_security', 'charms.opensearch.v0.models', 'charms.opensearch.v0.opensearch_backups', 'charms.opensearch.v0.opensearch_base_charm', 'charms.opensearch.v0.opensearch_config', 'charms.opensearch.v0.opensearch_distro', 'charms.opensearch.v0.opensearch_exceptions', 'charms.opensearch.v0.opensearch_fixes', 'charms.opensearch.v0.opensearch_health', 'charms.opensearch.v0.opensearch_internal_data', 'charms.opensearch.v0.opensearch_keystore', 'charms.opensearch.v0.opensearch_locking', 'charms.opensearch.v0.opensearch_nodes_exclusions', 'charms.opensearch.v0.opensearch_peer_clusters', 'charms.opensearch.v0.opensearch_performance_profile', 'charms.opensearch.v0.opensearch_plugin_manager', 'charms.opensearch.v0.opensearch_plugins', 'charms.opensearch.v0.opensearch_relation_peer_cluster', 'charms.opensearch.v0.opensearch_relation_provider', 'charms.opensearch.v0.opensearch_secrets', 'charms.opensearch.v0.opensearch_tls', 'charms.opensearch.v0.opensearch_users', 'charms.operator_libs_linux.v0.passwd', 'charms.operator_libs_linux.v1.systemd', 'charms.operator_libs_linux.v2.snap', 'charms.tls_certificates_interface.v3.tls_certificates'] 2025-03-05 16:57:48.879 Setting up StoreService 2025-03-05 16:57:49.019 HTTP 'POST' for 'https://api.charmhub.io/v1/charm/libraries/bulk' with params None and headers {'User-Agent': 'charmcraft/3.4.3.post51+g6153055c ubuntu/24.04 (x86_64) python/3.10.12'} 2025-03-05 16:57:49.728 Verifying local lib LibData(lib_id='6c3e6b6680d64e9c89e611d1a15f65be', api=0, patch=40, content='<lib file content>') 2025-03-05 16:57:49.728 Library None not found in Charmhub. ```

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.8-27b
Impact: 45
Quick Win: 31.5
Staleness: 60
Complexity: 30
Confidence: 85
Support Request: 10
keep open fetch-lib (all) fails with cryptic 'Library None not found in Charmhub' when a local lib is unpublished; maintainers confirmed the cause and unhelpful message, but the buggy error path in store.py remains unfixed in current code.
qwen/qwen3.6-35b-a3b
Staleness: 65
Complexity: 40
Confidence: 85
Support Request: 10
keep open Bug report for cryptic Library None not found in Charmhub error during charmcraft fetch-lib, acknowledged by maintainers as unhelpful and needing better error messaging.
qwen3.6-35b-a3b-mtp-q6
Staleness: 65
Complexity: 20
Confidence: 85
Support Request: 10
keep open Charmcraft fetch-lib fails with cryptic Library None not found in Charmhub error when encountering unpublished or invalid libraries. Maintainers acknowledge the unhelpful message and agree it needs improvement, but no fix has been implemented yet.
qwen3.6-35b-a3b-mtp-q6
Staleness: 50
Complexity: 40
Confidence: 85
Support Request: 10
keep open Charmcraft fetch-lib fails with a cryptic Library None not found error and lacks detailed output. Maintainers acknowledge the issue and agree better error reporting is needed.
qwen3.6-35b-a3b-mtp-q6
Staleness: 65
Complexity: 20
Confidence: 75
Support Request: 10
needs triage charmcraft fetch-lib fails with a cryptic Library None not found error and omits detailed per-library status updates. Open and under discussion, awaiting clearer error messaging and restoration of verbose output for invalid or unpublished libraries.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/charmcraft#2084 (confidence 70%)

    Reporter expected this PR's 'better error message with fetch-lib' to resolve it, but the per-lib loop path (store.py:1605) still uses parsed_args.library and reproduces the 'Library None' message, so it only addressed a different code path.

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.
77%
#2503 [WIP] Fix fetch-lib error in charmcraft causing library not found charmcraft closed Closed as abandoned. The PR aimed to fix an incorrect "Library None not found" error in charmcraft's fetch-lib by updating store.py. Marked WIP and AI-generated, it lacked tests and review, so it was closed without merging.
74%