`name` field missing from packed charm's `metadata.yaml` when defined in `charmcraft.yaml` alongside a separate `metadata.yaml`
Metadata
Current evaluation
Packed charm metadata.yaml omits name when name is in charmcraft.yaml and separate metadata.yaml lacks it, making charm undeployable. Confirmed by second user; no maintainer triage yet.
Suggested action: needs triage
Reason: Unlabelled issue with no maintainer response; code inspection shows get_metadata_yaml returns raw metadata.yaml when present, bypassing name from charmcraft.yaml. Clear reproducer and second confirmation, but needs maintainer triage.
Evaluated by: mr-cal-bot
Impact:
65
Quick Win:
30
Complexity:
45
Confidence:
80
Actionability:
85
Issue body
### Check existing issues
- [x] I've verified that this bug isn't described by any existing issues.
### Bug description
When a project has `name` in `charmcraft.yaml` and a separate `metadata.yaml` (without `name`), the packed `.charm` file contains a `metadata.yaml` with no `name` field. This makes the charm undeployable — Juju rejects it with `"metadata: name: expected string, got nothing"`.
### Steps to reproduce
1. Create a project with `name: my-charm` in `charmcraft.yaml` and a separate `metadata.yaml` that has `summary`, `description`, and relations but **no** `name` field.
2. Run `charmcraft pack --destructive-mode`.
3. Unzip the resulting `.charm` and inspect `metadata.yaml` — `name` is absent.
4. Attempt to deploy locally: `juju deploy ./my-charm_*.charm` → fails with `"metadata: name: expected string, got nothing"`.
### Environment
charmcraft 4.0.1 (snap), destructive mode, Ubuntu 24.04 amd64.
### charmcraft.yaml
```yaml
name: example-charm
type: charm
platforms:
ubuntu@24.04:amd64:
parts:
charm: {}
With a separate `metadata.yaml` containing `summary`, `description`, and relations but no `name`.
```
### Log output
```shell
juju.errors.JujuError: {"error":"cannot upload charm: invalid charm archive: metadata: name: expected string, got nothing","error-code":"bad request"}
```
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| ~deepseek/deepseek-pro-latest |
Impact:
65
Quick Win:
30
Complexity:
45
Confidence:
80
Actionability:
85
|
needs triage | Packed charm metadata.yaml omits name when name is in charmcraft.yaml and separate metadata.yaml lacks it, making charm undeployable. Confirmed by second user; no maintainer triage yet. | |
| qwen/qwen3.6-35b-a3b |
Impact:
75
Quick Win:
45
Complexity:
30
Confidence:
75
Actionability:
85
|
needs triage | Charm packed with name in charmcraft.yaml and separate metadata.yaml (without name) results in undeployable charm missing name field | |
| qwen/qwen3.8-27b |
Impact:
80
Quick Win:
36
Staleness:
45
Complexity:
55
Confidence:
75
Support Request:
5
|
needs triage | Charmcraft 4.0.1 packs a metadata.yaml without the `name` field when `name` is defined in charmcraft.yaml and a separate metadata.yaml (lacking `name`) exists, making the charm undeployable in Juju. Confirmed by a second user; no maintainer response yet. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
50
Complexity:
35
Confidence:
85
Support Request:
5
|
needs triage | Packing a charm with a separate metadata.yaml omits the name field when defined only in charmcraft.yaml, breaking deployment. Unlabelled and awaiting maintainer triage. | |
| qwen3.6-35b-a3b-mtp-q6 |
Staleness:
45
Complexity:
35
Confidence:
85
Support Request:
5
|
needs triage | charmcraft pack omits the name field from metadata.yaml when name is defined in charmcraft.yaml but missing from a separate metadata.yaml, causing Juju deployment failures. Currently unlabelled and awaiting maintainer review. |
Update history
No update history recorded yet.
Related work
-
Related To:
charmcraft#1530
(confidence 80%)
Earlier issue about metadata.yaml not updating from charmcraft.yaml; resolved by PR #2874, but the separate metadata.yaml case may remain.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1070 Incorrect charm name listed in `Charms packed:` output after pack | charmcraft | closed | Reported `Charms packed:` output showing a stale charm name after packing a hybrid machine/k8s charm; author sed-i retracted it on 2023-04-14 ("My bad. Everything is ok.") and it was closed with no code change. | |
| #1530 Changing charmcraft.yaml doesn't update the resulting charm's metadata.yaml | charmcraft | open | The original stale metadata.yaml bug was fixed by merged PR #2874; a later Charmcraft 5.5.0 stale-repack variant remains tracked in craft-application#821. |