← 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

Bulk fetch-lib aborts on an unavailable local library and misleadingly prints “Library None not found”; current code still uses the absent CLI argument, while PR #2505 remains open.

Suggested action: keep open

Reason: The current implementation interpolates parsed_args.library in both bulk-fetch not-found branches, so an omitted argument produces exactly the reported None value. The public reproducer and comments identify unpublished or invalid LIBIDs as the trigger, while PR #2505 targets this path but remains open and unmerged.

Evaluated by: mr-cal-bot

Impact: 43 Quick Win: 25 Complexity: 38 Confidence: 96 Actionability: 92

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
stealth/space-bunny-alpha
Impact: 43
Quick Win: 25
Complexity: 38
Confidence: 96
Actionability: 92
keep open Bulk fetch-lib aborts on an unavailable local library and misleadingly prints “Library None not found”; current code still uses the absent CLI argument, while PR #2505 remains open.
stealth/space-bunny-alpha
Impact: 38
Quick Win: 22
Complexity: 30
Confidence: 82
Actionability: 82
keep open Bulk `charmcraft fetch-lib` fails fast with "Library None not found in Charmhub." instead of per-library status; cause confirmed in store.py, fix PR #2505 open/stalled.
qwen/qwen3.6-35b-a3b
Impact: 30
Quick Win: 19
Complexity: 20
Confidence: 70
Actionability: 80
keep open charmcraft fetch-lib shows cryptic 'Library None not found' error instead of actual library name. Fix PR #2505 exists but has unresolved review comments and failing CI.
qwen/qwen3.8-27b
Impact: 45
Quick Win: 32
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.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: charmcraft#2505 (confidence 98%)

    Open PR explicitly fixes the cryptic None name by using the library's full name and adds test coverage.

  • Related To: charmcraft#2504 (confidence 94%)

    A prior WIP PR addressed the same Charmcraft 3.4.3 fetch-lib failure but was closed without completing review or tests.

  • Related To: charmcraft#2503 (confidence 94%)

    Another closed WIP PR attempted to address the related fetch-lib library-not-found failure.

Related issues

Issue Project State Summary Similarity
#2503 [WIP] Fix fetch-lib error in charmcraft causing library not found charmcraft closed PR #2503 was closed unmerged as unfinished WIP; tests, review, and security checks were not completed. The fetch-lib “Library None” bug remains, while PR #2505 is still open.
77%
#2505 fix: fetch-lib error message showing "Library None not found" charmcraft open Fixes misleading 'Library None not found' error in `charmcraft fetch-lib` by using `lib_data.full_name` instead of `parsed_args.library`. PR is approved with CI passing but has 1 unresolved review comment.
76%
#1788 `fetch-lib` should work from anywhere charmcraft open `fetch-lib` regressed in Charmcraft 3.1.1 by requiring charmcraft.yaml outside projects; a minimal reproducer was provided, and a maintainer explicitly kept the compatibility request open.
75%
#2504 [WIP] Fix fetch-lib error in charmcraft 3.4.3 charmcraft closed Closed unmerged without tests, review, or CodeQL; the WIP fix was abandoned, while follow-up PR #2505 remains open for issue #2204.
71%
#1671 `fetch-libs` command requires being logged into charmhub charmcraft closed Fixed by merged PR #1702 (commit 1da46c8f), which made fetch-libs use anonymous Charmhub access. PR #1701 also fixed handling of library names containing underscores.
70%