[WIP] Fix fetch-lib error in charmcraft causing library not found#2503
Draft
[WIP] Fix fetch-lib error in charmcraft causing library not found#2503
Conversation
Co-authored-by: lengau <4305943+lengau@users.noreply.github.com>
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:11
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.
Fix error message for fetch-lib command when library is None
charmcraft fetch-libis run without arguments to update all libraries, and a library is not found in Charmhub, the error message incorrectly shows "Library None not found in Charmhub." instead of showing the actual library namestore.pyuseparsed_args.libraryin error messages (lines 1539 and 1562), but when running without arguments,parsed_args.libraryis Noneparsed_args.library, allowing the more detailed error fromget_libraries_metadata()to propagatelib_data.full_nameinstead ofparsed_args.libraryin the error messageOriginal 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