`charmcraft list-lib` does not work without a `metadata.yaml` file
Metadata
Current evaluation
charmcraft list-lib required metadata.yaml for the charm name. Fixed by merged PR #1974 (commit beb5c145), making list-lib read the name from charmcraft.yaml; tracked internally as CRAFT-3695.
Resolution: closed resolved
Reason: Reporter confirmed "Fixed by #1974"; commit beb5c145 ("feat: check charmcraft.yaml for charm name (#1974)") is present in charmcraft/application/commands/store.py history and now resolves the name via utils.get_name_from_yaml(), so list-lib works without metadata.yaml.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
The command `charmcraft list-lib` seems to expect the charm name to be in a `metadata.yaml` file, but newer charms do not have this file, as everything is in `charmcraft.yaml`.
### To Reproduce
1. Go to a directory which contains a charm with only a `charmcraft.yaml` file (no `metadata.yaml`)
2. Run `charmcraft list-lib`
### Environment
Latest charmcraft (3a094837)
### charmcraft.yaml
```yaml
# This file configures Charmcraft.
# See https://juju.is/docs/sdk/charmcraft-config for guidance.
name: listlibs
type: charm
title: Charm Template
summary: A very short one-line summary of the charm.
description: |
A single sentence that says what the charm is, concisely and memorably.
A paragraph of one to three short sentences, that describe what the charm does.
A third paragraph that explains what need the charm meets.
Finally, a paragraph that describes whom the charm is useful for.
bases:
- build-on:
- name: ubuntu
channel: "22.04"
run-on:
- name: ubuntu
channel: "22.04"
config:
options:
log-level:
description: |
Configures the log level of gunicorn.
Acceptable values are: "info", "debug", "warning", "error" and "critical"
default: "info"
type: string
containers:
httpbin:
resource: httpbin-image
resources:
httpbin-image:
type: oci-image
description: OCI image for httpbin
upstream-source: kennethreitz/httpbin
```
### Relevant log output
```shell
Can't access name in 'metadata.yaml' file. The 'list-lib' command must either be executed from a valid project directory, or specify a charm name using the --charm-name option.
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | charmcraft list-lib required metadata.yaml for the charm name. Fixed by merged PR #1974 (commit beb5c145), making list-lib read the name from charmcraft.yaml; tracked internally as CRAFT-3695. | |
| stealth/space-bunny-alpha | — | closed resolved | Fixed by merged PR #1974 (commit beb5c145): `list-lib` now reads the charm name from `charmcraft.yaml` instead of requiring `metadata.yaml`. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Fixed by PR #1974. The charmcraft list-lib command now correctly reads the charm name from charmcraft.yaml instead of requiring metadata.yaml, resolving the reported bug. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed by PR #1974. The charmcraft list-lib command now correctly reads the charm name from charmcraft.yaml instead of requiring metadata.yaml, resolving the reported bug. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed a bug where charmcraft list-lib failed without metadata.yaml. The resolution was merged via pull request #1974, enabling the command to read charm names from charmcraft.yaml. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | charmcraft list-lib failed when metadata.yaml was absent. The bug is fixed by PR #1974, which updates the command to read the charm name from charmcraft.yaml. The issue is closed. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/charmcraft#1974
(confidence 96%)
PR 'Check charmcraft.yaml for charm name' merged as commit beb5c145; author DanielArndt
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1974 Check `charmcraft.yaml` for charm name | charmcraft | merged | Merged PR #1974 (commit beb5c145), fixing #1973: list-lib now reads the charm name from charmcraft.yaml instead of requiring metadata.yaml. | |
| #1227 `create-lib` command breaks without a metadata.yaml file | charmcraft | closed | Fixed by merged PR #1228 (commit cf6c8526), which made `create-lib` fall back to charmcraft.yaml for the charm name instead of requiring metadata.yaml. | |
| #1228 commands(store): make create-lib work without a metadata.yaml file | charmcraft | merged | Merged #1228 (commit cf6c8526) fixed #1227 by allowing create-lib to use charmcraft.yaml when metadata.yaml is absent; it also advanced #1193. |