[WIP] Fix fetch-lib error in charmcraft 3.4.3#2504
Draft
Conversation
When running `charmcraft fetch-lib` without arguments and encountering a LibraryError, the error message was showing "Library None not found in Charmhub." instead of the actual library name. This fix: 1. Re-raises the original LibraryError from get_libraries_metadata instead of creating a new one with parsed_args.library (which could be None) 2. Uses lib_data.full_name instead of parsed_args.library when a library tip is not found in the store Co-authored-by: lengau <4305943+lengau@users.noreply.github.com>
Copilot stopped work on behalf of
lengau due to an error
December 3, 2025 19:09
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Original prompt
This section details on the original issue you should resolve
<issue_title>[3.4.3] Charmcraft fetch-lib fails with
Library None not found in Charmhub.</issue_title><issue_description>### Bug Description
I am using charmcraft:
installed: 3.4.3.post51+g6153055c (6228) 60MB classicInstalled from channel
latest/edgeWe have done some few changes in the OpenSearch libs and now the
check_libsstarted 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