← Back to issue list

fix: fetch-lib error message showing "Library None not found"

View original Github issue

Metadata

Project
charmcraft
Number
#2505
Type
pull request
State
open
Author
copilot-swe-agent
Labels
—
Created
Updated
Closed
—

Current evaluation

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.

Suggested action: needs review

Reason: The PR is approved by 1 reviewer and all CI checks are passing, but there is 1 unresolved review comment that should be addressed before merge. The fix itself is straightforward—replacing `parsed_args.library` with `lib_data.full_name` in an error message—and is supported by unit tests and a spread test.

Evaluated by: mr-cal-bot

Impact: 40 Quick Win: 24 Complexity: 15 Confidence: 75 Actionability: 70

Issue body

Fixes #2204 where running `charmcraft fetch-lib` without arguments displays "Library None not found in Charmhub" instead of showing the actual library name when a library cannot be found. ## Changes Made - **Error message fix**: Updated `charmcraft/application/commands/store.py` line 1566 to use `lib_data.full_name` instead of `parsed_args.library` so the actual library name is displayed - **Exception handling**: Improved error handling (lines 1537-1545) to only override the error message when a specific library is requested; otherwise re-raises the original error with proper context - **Integration test**: Added `test_fetchlib_all_library_not_found` in `tests/integration/commands/test_store_commands.py` to verify the error message shows the library name when fetching all libraries - **Spread test**: Added `store/libraries-not-found` in `tests/spread/store/libraries-not-found/task.yaml` to test the command-line behavior end-to-end ## Root Cause When running `charmcraft fetch-lib` without arguments (to update all local libraries), `parsed_args.library` is `None`. The original code used this value directly in error messages, resulting in "Library None not found in Charmhub" instead of showing which specific library couldn't be found. ## Testing - ✅ Code compiles successfully - ✅ All 202 unit tests pass - ✅ Code passes linting checks - ✅ Integration test verifies error message contains library name - ✅ Spread test validates command-line behavior - ✅ Minimal changes preserve existing functionality --- - [ ] I've followed the [contribution guidelines](https://github.com/canonical/charmcraft/blob/main/CONTRIBUTING.md). - [ ] I've signed the [CLA](http://www.ubuntu.com/legal/contributors/). - [x] I've successfully run `make lint && make test`. - [ ] I've added or updated any relevant documentation. - [ ] I've updated the relevant release notes. <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/canonical/charmcraft/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b
Impact: 40
Quick Win: 24
Complexity: 15
Confidence: 75
Actionability: 70
needs review 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.
qwen/qwen3.6-35b-a3b
Impact: 40
Quick Win: 20
Complexity: 15
Confidence: 70
Actionability: 60
needs review Fixes misleading 'Library None not found' error in fetch-lib by using lib_data.full_name; approved by 1 reviewer with 1 unresolved comment, CI passing
~deepseek/deepseek-pro-latest
Impact: 42
Quick Win: 12
Complexity: 30
Confidence: 72
Actionability: 40
keep open Fixes fetch-lib error message to use lib_data.full_name instead of parsed_args.library, avoiding 'Library None not found'; adds tests. Under active iteration after maintainer feedback; type checking failing.
~deepseek/deepseek-pro-latest
Impact: 40
Quick Win: 8
Complexity: 35
Confidence: 70
Actionability: 30
keep open Fixes fetch-lib error message showing 'Library None not found' by using lib_data.full_name; adds integration/spread tests. Under review with failing CI and unresolved comment.
~deepseek/deepseek-pro-latest
Impact: 45
Quick Win: 11
Complexity: 40
Confidence: 62
Actionability: 40
needs review Fixes fetch-lib bulk mode error message showing 'Library None not found' by using lib_data.full_name; adds spread/integration tests. Approved but has 2 unresolved comments and failing lint/OSV-scanner CI.
stealth/space-bunny-alpha
Impact: 20
Quick Win: 6
Complexity: 30
Confidence: 76
Actionability: 45
needs review Fixes cryptic "Library None not found in Charmhub" in fetch-lib by using lib_data.full_name; plus exception-handling change and a spread test. Approved but 2 unresolved comments; author deleted the integration test after being told to run tests.
stealth/space-bunny-alpha
Impact: 27
Quick Win: 11
Complexity: 33
Confidence: 92
Actionability: 61
needs review Fixes fetch-lib's misleading "Library None not found" error and adds test coverage; one approval is present, but two review comments remain unresolved and most CI checks are still pending.
qwen/qwen3.6-35b-a3b
Impact: 35
Quick Win: 11
Complexity: 20
Confidence: 75
Actionability: 40
needs review Fixes error message in `charmcraft fetch-lib` to show actual library name instead of 'None'. Approved by 1 reviewer but has 2 unresolved review comments and multiple failing CI checks.
qwen/qwen3.8-27b
Impact: 15
Quick Win: 13
Staleness: 72
Complexity: 15
Confidence: 72
needs review Fixes 'Library None not found' error in deprecated fetch-lib command by using lib_data.full_name. Approved but 2 unresolved review comments, many CI failures, 266 days inactive. Bug still present in main.
qwen/qwen3.6-35b-a3b
Staleness: 72
Complexity: 18
Confidence: 78
needs review Updates charmcraft fetch-lib to show actual library names in error messages instead of None. Contains one approval, two unresolved review comments, and several failing CI checks. Currently awaiting maintainer feedback and CI fixes.
qwen3.6-35b-a3b-mtp-q6
Staleness: 90
Complexity: 15
Confidence: 85
close stale Fixes misleading error message in charmcraft fetch-lib by using actual library name instead of None. PR has been inactive for 210 days with unresolved maintainer feedback regarding test execution.
qwen3.6-35b-a3b-mtp-q6
Staleness: 85
Complexity: 15
Confidence: 75
close stale Fixes misleading 'Library None not found' error in charmcraft fetch-lib by using the actual library name. PR is inactive for over 200 days with unresolved type-checking failures and no maintainer follow-up.

Update history

Date Change
updated
updated
updated
updated
updated
updated
updated
updated
updated

Related work

  • Likely Fixed By: charmcraft#2204 (confidence 95%)

    This PR directly fixes the bug described in issue #2204 where `fetch-lib` without arguments shows 'Library None not found' instead of the actual library name.

  • Related To: charmcraft#1721 (confidence 80%)

    Related past issue about misleading fetch-lib error messages, fixed by PR #2084 for a different code path.

  • Related To: charmcraft#1754 (confidence 80%)

    Related past issue about `fetch-libs` error messages, fixed by PR #2034.

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.
78%
#2204 [3.4.3] Charmcraft fetch-lib fails with `Library None not found in Charmhub.` charmcraft 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.
76%
#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.
73%
#2034 fix(store): nicer error message when getting nonexistent libs charmcraft merged Merged PR #2034 (commit c9b51038), fixing #1754 by replacing Charmhub's unclear missing-library response with a clearer fetch-libs error.
71%