name` field missing from packed charm's `metadata.yaml` when defined in `charmcraft.yaml` alongside a separate `metadata.yaml`
Metadata
Current evaluation
charmcraft pack omits the name field from the packed charm's metadata.yaml when a separate metadata.yaml exists, causing Juju deployment failures and remaining open for triage.
Suggested action: needs triage
Reason: The issue is well-structured and clearly describes a reproducible bug, but it lacks labels, an assignee, and any maintainer response. It requires initial triage to categorize, prioritize, and route to the appropriate team for investigation.
Staleness:
25
Complexity:
40
Confidence:
90
Support Request:
0
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 |
|---|---|---|---|---|
| 2026-06-15 11:27:33.332654+00:00 | qwen3.6-35b-a3b-mtp-q6 |
Staleness:
25
Complexity:
40
Confidence:
90
Support Request:
0
|
needs triage | charmcraft pack omits the name field from the packed charm's metadata.yaml when a separate metadata.yaml exists, causing Juju deployment failures and remaining open for triage. |
| 2026-06-15 11:25:29.065722+00:00 | pending | — | — | — |